开发者

Is there any tool to generate DTOs from entities?

开发者 https://www.devze.com 2023-02-01 05:58 出处:网络
I want to generate DTOs from entities in a totally automated way. By th开发者_JS百科at I mean some tool reading my .edmx model and converting it to DTO\'s. I\'ve seen this in stackoverflow but that is

I want to generate DTOs from entities in a totally automated way. By th开发者_JS百科at I mean some tool reading my .edmx model and converting it to DTO's. I've seen this in stackoverflow but that is a superficial level of automation. I do not want to write too much code... if possible not to write any code at all.


Normally, the Entity Framework generates C# entity types for your model using an internal templating system. In Entity Framework 4, you can replace this with a custom T4 template. In addition to emitting the entity types, you could change the template to admit DTOs at the same time.

Right-click the model designer surface. Click "Add Code Generation Item." Customize the emitted T4 template.

0

精彩评论

暂无评论...
验证码 换一张
取 消