简体   繁体   English

MetadataException [无法加载指定的元数据资源]

[英]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. 关于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 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). x86 / x64位我已经仔细检查了编译版本和框架版本,一切都应按原样进行(在这种情况下,它表示.net 4和x86)。

Path to res://*/Something.ssdl 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. 我试过手动定位dll路径,但只有非常怪异的错误。 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). 但是,有报告说3层应用程序必须完全匹配(具有印刷的装配版本等)。 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. 使用.NET Reflector,我在数据类程序集中的(csdl,ssdl,msl)中找到了资源名称。 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). 我还记住,资源会获取路径名称和原始文件名(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. 这是3层应用程序,其中edmx位于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). 我使用内置的Visual Studio 2010实体Poco生成器创建了POCOS。将Pocos移至业务层(是的,我修复了移动pocos时发生的路径错误)。

The very problem (as wroted in header) appears when I, in my third layer console test application, try asking the poco for data. 当我在我的第三层控制台测试应用程序中尝试向poco索要数据时,就出现了这个问题(如标头中所述)。 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? 因为看来这与错误的逻辑相对应,所以我认为搜索的答案更多是“我将如何在Presentaton-业务-数据”分层系统中使用EF?

I think there is an incorrect connection string in App.config file. 我认为App.config文件中有不正确的连接字符串。 You can try this: 您可以尝试以下方法:

Data Source=(IP address of DB);Initial Catalog=(DB name);Integrated Security=True;MultipleActiveResultSets=True

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. 如果要将EF4与POCO T4模板一起使用,则必须在实体设计器中关闭默认生成器。 POCO template can be placed in separate project but project defining entity model (and possibly derived ObjectContext) must have reference to this assembly. POCO模板可以放在单独的项目中,但是项目定义实体模型(以及可能派生的ObjectContext)必须引用此程序集。

Follow these tutorials to get introduction into using POCOs: 请遵循以下教程,以获取有关使用POCO的介绍:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM