MetadataException [Unable to load the specified metadata resource]

I really need help on this. There are a lot of information about the error in stackoverflow. However none of them is of help. A problem description is following in bottom of this question.

MetadataArtifactProcessing
- this is set to "embed in output assembly", which is correct

app.config
- I know the connectionstring have to be in the config file from the running assembly. I've done this.

x86/x64 bit I've doublechecked the compilations and framework versions and everything is as it should be (which in this case means .net 4 and x86).

Path to res://*/Something.ssdl
This is, perhaps, the most error-prone option. I've tried locate the dll path manually but only got very spooky errors. Assembly not found or invalid codebase or version. If I leave it a star, it will seach the available assemblies. However there are reports saying that 3-tier applications must exactly match (with printed assembly version and so on). Though, the how-description are very unclear and does not work either.

Name of resource
.NET Reflector are used and I found the resources names in (csdl, ssdl, msl) in the data class assembly. That name is exactly corresponding to the config file. I have also tooked in mind that the resources get the name of the path and original filename (maph/maph/filename.edmx).

Name of the connectionstring
The add name='' of the connectionstring is exactly corresponding to the name being searched for.

Description
This is a 3-tier application where edmx is located in Name.Data.dll. I created POCOS with Entity Poco generator built-in Visual Studio 2010. Moved the Pocos to the business layer (and yes, i fixed that path error which occurs when moving the pocos).

The very problem (as wroted in header) appears when I, in my third layer console test application, try asking the poco for data. I really hope you understand this isn't a "just a duplicate" and I'm in really need of conversation to fix this.

Thank's in advanced,

UPDATE:
Because it appears that this correspond to a false logic, I think the answers I search for is more of the type "how would i use EF in a presentaton - business - data" layered system?


Not sure if this is directly related to your current exception but there is obviously some problem with your project structure.

If you want to use EF4 with POCO T4 template you must turn off default generator in Entity designer. POCO template can be placed in separate project but project defining entity model (and possibly derived ObjectContext) must have reference to this assembly.

Follow these tutorials to get introduction into using POCOs:

  • Part 1
  • Part 2

  • I think there is an incorrect connection string in App.config file. You can try this:

    Data Source=(IP address of DB);Initial Catalog=(DB name);Integrated Security=True;MultipleActiveResultSets=True
    
    链接地址: http://www.djcxy.com/p/38798.html

    上一篇: 发布版本中的MetadataException

    下一篇: MetadataException [无法加载指定的元数据资源]