Unable to load the specified metadata resource

Got this error while working on Entity Framework this morning. Turns out it was due to the fact that I moved .edmx files to a new folder called Entities. The solution was to add it to connectionstring.
So, something like this:

connectionString="metadata=res://*/SysOrder.csdl|res://*/SysOrder.ssdl|res://*/SysOrder.msl;provider=System.Data.SqlClient;provider connection string="data source=server;initial catalog=dbname;user id=user;password=password;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"

is now like this:

connectionString="metadata=res://*/Entites.SysOrder.csdl|res://*/Entities.SysOrder.ssdl|res://*/Entities.SysOrder.msl;provider=System.Data.SqlClient;provider connection string="data source=server;initial catalog=dbname;user id=username;password=password;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient"

Btw, this was the error:

StackTrace: " at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)\r\n at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource..ctor(String originalPath, String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)\r\n at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)\r\n at System.Data.Metadata.Edm.MetadataCache.SplitPaths(String paths)\r\n at System.Data.Common.Utils.Memoizer`2.Result.GetValue()\r\n at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)\r\n at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)\r\n at System.Data.Objects.ObjectContext..ctor(EntityConne
ction connection, Boolean isConnectionConstructor)\r\n at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)\r\n at Informatics.Data.Entities.SysOrderEntities..ctor() in C:\\Projects\\Informatics\\Websites\\Informatics.Internet\\Informatics.Data\\Entities\\SysOrder.Designer.cs:line 34\r\n at Informatics.Data.SysOrderManager..ctor() in C:\\Projects\\Informatics\\Websites\\Informatics.Internet\\Informatics.Data\\Entities\\SysOrderManager.cs:line 10\r\n at Informatics.Data.SysOrderManager.GetSysOrderManager() in C:\\Projects\\Informatics\\Websites\\Informatics.Internet\\Informatics.Data\\Entities\\SysOrderManager.cs:line 15\r\n at Informatics.Business.TestDrive.GetTrial(Trial trialDto) in C:\\Projects\\Informatics\\Websites\\Informatics.Internet\\Informatics.Business\\TestDrive.cs:line 46\r\n at Informatics.Business.Trial.TestDriveTrialRequest(Setting setting, String firstName, String lastName, String company, String address, String address1, String city, Str
ing state, String zip, String country, String email, String phone, String reseller, String subscribe, String productName, String ipaddress) in C:\\Projects\\Informatics\\Websites\\Informatics.Internet\\Informatics.Business\\Trial.cs:line 210\r\n at Informatics.Websites.layouts.waspbarcode.forms.InventoryControlDemo.BtnSubmit_Click(Object sender, EventArgs e) in C:\\Projects\\Informatics\\Websites\\Informatics.Internet\\Informatics.Websites\\layouts\\waspbarcode\\forms\\inventory_control_demo.ascx.cs:line 32"
TargetSite: {System.Collections.Generic.List`1[System.Data.Metadata.Edm.MetadataArtifactLoaderResource] LoadResources(System.String, System.String, System.Collections.Generic.ICollection`1[System.String], System.Data.Metadata.Edm.MetadataArtifactAssemblyResolver)}

Leave a Reply

Your email address will not be published.