Embed custom SSDL in EF dll

99封情书 提交于 2019-12-11 06:18:43

问题


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.

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.

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?

Thanks in advance.


回答1:


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.

Thanks to Ladislav for making me look a little more closely.



来源:https://stackoverflow.com/questions/6856088/embed-custom-ssdl-in-ef-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!