实体框架元数据异常-dll资源中没有csdl,ssdl,msl [英] Entity framework metadata exception - No csdl, ssdl, msl in dll resources

查看:61
本文介绍了实体框架元数据异常-dll资源中没有csdl,ssdl,msl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有DAL(模型第一个实体框架4.1)和在单独项目中使用它的Service.一切工作正常,但是在进行一些较小的更改(例如我从数据库生成模型)后,它停止了工作.我现在收到元数据异常. 经过许多小时的研究,我下载了ILSpy并检查DAL.dll中是否没有资源. 我的连接字符串如下:

I have DAL (model first entity framework 4.1) and Service which is using it in separate projects. Everything was working fine, but after some minor changes (for example I generated model from database) it stoppedd working. I am now getting metadata exception. After many hours of research I downloaded ILSpy and checked that inside DAL.dll there are no resources. My connection string looks like:

metadata=res://*/DataModel.TerminalRegistryModel.csdl|
         res://*/DataModel.TerminalRegistryModel.ssdl|
         res://*/DataModel.TerminalRegistryModel.msl;

EDMX文件元数据工件处理中的ANd设置为Embed in Output Assembly. 什么会导致我的问题?

ANd in EDMX file metadata artifact processing is set to Embed in Output Assembly. What can cause my problem?

推荐答案

标准元数据字符串如下所示:
metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl
在大多数情况下,这都可以正常工作.但是,在某些Entity Framework中会感到困惑,并且不知道要查找哪个dll.因此,请将元数据字符串更改为:
metadata=res://nameOfDll/Model.csdl|res://nameOfDll/Model.ssdl|res://nameOfDll/Model.msl

The standard metadata string looks like this:
metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl
And this works fine in most cases. However, in some Entity Framework get confused and does not know which dll to look in. Therefore, change the metadata string to:
metadata=res://nameOfDll/Model.csdl|res://nameOfDll/Model.ssdl|res://nameOfDll/Model.msl

这篇关于实体框架元数据异常-dll资源中没有csdl,ssdl,msl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆