问题描述
作为我正在开发的项目的一部分,我们有一个要求来支持Sql Server和Sql Server Compact。现在,只有这两个,我不介意通过默认的Sql Server一个T4模板创建一个自定义的ssdl,这样可以正常工作。但是,这确实涉及传递创建的文件并引用其路径。
As part of a project I'm working on we have a requirement to support Sql Server and Sql Server Compact. Now as it's only the two, I don't mind creating a custom ssdl generated via a T4 template from the default Sql Server one, which works fine. However, this does involve passing round the created file and referencing the path to it.
当涉及到部署时,我想将该自定义ssdl文件嵌入到直接,并且最好使用标准的ssdl来访问它,例如有res://*/Model.SqlServerCe.ssdl或在连接字符串中类似的东西。
When it comes to deployment I'd like to embed that custom ssdl file into the dll directly, and preferably access it as you would with a standard ssdl, e.g. have res://*/Model.SqlServerCe.ssdl or something similar in a connection string.
我已经试图搞砸VS构建动作,并有一点的谷歌,但似乎找不到任何相关的嵌入自定义额外的元数据文件到一个单一的dll。是否有人遇到过或知道该怎么办?
I've tried messing around with the VS build actions and had a bit of a google but can't seem to find anything relevant to embedding custom extra metadata files into a single dll. Is this something anyone's come across before or know hows to do?
提前感谢。
推荐答案
原来我有点傻,设置ssdl嵌入到构建操作中,然后可以通过其完全限定名称访问嵌入资源,例如 res:// * /< dll命名空间> .Model.SqlServerCe.ssdl
,我通过调用Assembly.GetManifestResourceNames()设法找到。很明显,如果你考虑,那么
Turns out I was being a bit silly, setting the ssdl to embed in the build actions, you can then access the embed resource via its fully qualified name, e.g. res://*/<dll namespace>.Model.SqlServerCe.ssdl
, which I managed to find from doing a call Assembly.GetManifestResourceNames(). Obvious if you think about it, doh.
感谢Ladislav让我看起来更加紧密。
Thanks to Ladislav for making me look a little more closely.
这篇关于在EF dll中嵌入自定义SSDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!