在代码生成的设计时读取实体 [英] Reading Entities at Design Time for Code Gen

查看:67
本文介绍了在代码生成的设计时读取实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个Visual Studio加载项,它根据EF实体模型生成代码(服务调用,UI等)。

谁能告诉我在设计时阅读EF实体模型的最简单方法是什么?


谢谢!

解决方案

嗨*,

可能你只对模型的CSDL部分感兴趣。考虑到,EDMX文件只是XML文件,那么我认为LINQ to XML是最简单的方法。要获得CSDL,您可以重复使用代码,例如 http://blog.vyvojar.cz/jirka/archive/2009/01/25/mapping-stored-procedures-that-are-returning-non-entity-result-在-edm.aspx


I want to build a Visual Studio add-in that generates code (service calls, UI, etc) based on an EF entity model.

Can anyone tell me what's the easiest way to read the EF entity model at design time to do this?


Thanks!

解决方案

Hi *,

probably you're only interested in CSDL part of model. Taking into account, that EDMX file is justXML file, then I think LINQ to XML is easiest way. To get CSDL you may re-use code used i.e. in http://blog.vyvojar.cz/jirka/archive/2009/01/25/mapping-stored-procedures-that-are-returning-non-entity-result-in-edm.aspx.


这篇关于在代码生成的设计时读取实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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