How can I create an ObjectContext from separate ssdl + csdl + msl files and no edmx?

三世轮回 提交于 2019-12-21 23:06:04

问题


Given:

  1. An empty C# project
  2. 3 loose files: an SSDL, CSDL and a MSL (generated elsewhere)
  3. No EDMX file

What modifications/additions should I perform on project to compile these files into a T4-based ObjectContext (e.g. using POCOs T4 generators)...

  1. if I already have all classes generated for entities?
  2. if I have no classes generated for entities?

Would it be easier to generate the ObjectContext and or classes if I first combine the files into an EDMX with no Designer section?


回答1:


Working solution:

Generate SSDL, CSDL, MSL files and include in project as embedded resources.

Generate EDMX by combining those files and include in project for T4s to look at.

Modify EF's connection string in App.Config: add default namespace of assembly (+ '.') before resources' file names.

Point T4 at EDMX and transform templates.



来源:https://stackoverflow.com/questions/6114702/how-can-i-create-an-objectcontext-from-separate-ssdl-csdl-msl-files-and-no-e

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