I have a three-level project.
1) Project.Data (EDMX file)
2) Project.Model (POCO)
3) Project.Console (console application)
I added a connection string to Project.Console .
<?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="ProjectEntities" connectionString="metadata=res://*/Project.csdl|res://*/Project.ssdl|res://*/Project.msl;provider=System.Data.SqlClient;provider connection string="Data Source=PC\SQLEXPRESS;Initial Catalog=Project;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /> </connectionStrings> </configuration>
Project.Model built using the EntityObject T4 template in VS2010. It generates an ObjectContext class, with this constructor:
public ProjectEntities() : base("name=ProjectEntities", "ProjectEntities") { this.ContextOptions.LazyLoadingEnabled = true; OnContextCreated(); }
I am just trying to instantiate a context object in Project.Console :
namespace Project.Console { class Program { static void Main(string[] args) { ProjectEntities pe = new ProjectEntities(); } } }
However, I get a MetadataException was unhandled in the constructor. Unable to load the specified metadata resource. statement Unable to load the specified metadata resource.
I did a lot of research (Googling) and found that this is a connection problem with these resources. I can't seem to find a resolution.
Any help is appreciated.
Dustin laine
source share