简体   繁体   English

使用edmgen生成实体类

[英]Generating Entity Classes using edmgen

I have a edmx file created using the entity entity framework model. 我有一个使用实体实体框架模型创建的edmx文件。

Whenever I make some changes in the edmx(Like removing a column from the entity), I would like to generate the entity classes( Designer.cs ). 每当我对edmx进行一些更改(例如从实体中删除列)时,我都希望生成实体类( Designer.cs )。 I know I can do this by right clicking the edmx file and Run custom tool 我知道我可以通过右键单击edmx文件并运行自定义工具来做到这一点

I wanted to do this using edmgen tool. 我想使用edmgen工具做到这一点。 But the edmgen tool needs the msdl and csdl files. 但是edmgen工具需要msdl和csdl文件。 But I have all the contents in the edmx file. 但是我的所有内容都在edmx文件中。

Is there any way to specify the edmx file to the edmgen command. 有什么方法可以将edmx文件指定给edmgen命令。

If you have configured everything correctly .Designer.cs file should be generated automatically without using Run custom tool . 如果正确配置了所有内容,则应自动生成Designer.cs文件,而不使用运行自定义工具 EDMX is just file for Visual Studio - you must use MSL, CSDL and SSDL for EdmGen. EDMX只是Visual Studio的文件-您必须将MSL,CSDL和SSDL用于EdmGen。 You can set up your EDMX to generate SSDL, MSL and CSDL files for you but in such case you will also have to use these files in deployment and connection string instead of resources used by default. 您可以设置EDMX为您生成SSDL,MSL和CSDL文件,但是在这种情况下,您还必须在部署和连接字符串中使用这些文件,而不是默认使用的资源。 To set up this change Metadata Artifacts Processing from Embed in Output Assembly to Copy to Output Directory . 要设置此更改,将元数据伪像处理从“ 嵌入到输出程序集中” 复制到“输出目录”

You can also check EdmGen2 which should be able to opeerate with EDMX directly. 您还可以检查EdmGen2 ,它应该可以直接使用EDMX。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM