Yes I did read and try entity framework Unable to load the specified metadata resource
I typically use code first and have had no issues. However I needed to troubleshoot a project with EDMX
Context:
public partial class x500Entities : DbContext
{
public x500Entities()
: base("name=x500Entities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<WorkerPublicExtended> WorkerPublicExtendeds { get; set; }
}
connection string :
<add name="x500Entities"
connectionString="metadata=res://*/CDISWorkerPublicExtended.csdl|res://*/CDISWorkerPublicExtended.ssdl|res://*/CDISWorkerPublicExtended.msl;provider=System.Data.SqlClient;provider connection string="data source=xserver;initial catalog=x500;persist security info=True;user id=xuser;password=xpassword;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient"/>
ERROR :
An exception of type 'System.Data.Entity.Core.MetadataException' occurred in EntityFramework.dll but was not handled in user code Additional information: Unable to load the specified metadata resource.
Upon hitting this line:
return context.WorkerPublicExtendeds.FirstOrDefault(x => x.upperIDSID == idsid.ToUpper().Trim());
Complete Method :
public WorkerPublicExtended GetEmployee(string idsid)
{
using (x500Entities context = new x500Entities())
{
return context.WorkerPublicExtendeds.FirstOrDefault(x => x.upperIDSID == idsid.ToUpper().Trim());
}
}
- Why is this happening?
- I connected to sql server ssms and I don't see the table
WorkerPublicExtended
that I have seen in diagram edmx and the model, I don't see where that name is translated to a real table name. How is this?