I try test my Entity class, but i always get a Failure:
System.Data.MetadataException
:
Unable to load the specified metadata resource.
I think the problem is in connection string and App.config
. I try a lot of stuff: add something to build events, changing config name, copy the config file into solution folder, project folder, project_folder/bin/debug, again change a lot of names... but it still doesn't work.
I have a "AppProject" solution containing 3 projects:
- "Entity"
- "WebTest"
- "MVCApp"
The Entity project has a .edmx
file, and simple POCO classes. When I add the connection string from the Entity/App.config
into MVCApp/Web.config
, the "MVCApp" and database works fine.
When I copy the Entity/App.config
into WebTest/App.config
it doesn't work. I don't know where the problem is.
I use a Visual NUnit, but when I try turn on in NUnit still doesn't work.
My App.config
:
<connectionStrings>
<add name="UserDB"
connectionString="metadata=res://*/Model.Entity.csdl|
res://*/Model.Entity.ssdl|
res://*/Model.Entity.msl;
provider=System.Data.SqlClient;
provider connection string=
"Data Source=.\SQLExpress;
Initial Catalog=TestDB;
Integrated Security=True;
MultipleActiveResultSets=True""
providerName="System.Data.EntityClient" />
<!-- NOTE: line breaks in the above connection string have been inserted only
for better legibility. -->
</connectionStrings>