用于 LINQ-to-SQL 和实体框架代码生成器的编程 API
有哪些选项可以为 LINQ-to-SQL 和 实体框架 上下文和数据实体对象生成类定义?我了解如何使用 Visual Studio 工具,但是是否有一个编程 API 可以用来定义模型并从另一个应用程序生成相应的代码?
What options do I have for generating class definitions for LINQ-to-SQL and Entity Framework context and data entity objects? I understand how to use the Visual Studio tools, but is there a programmatic API I can use to define the model and generate the corresponding code from another application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Linq to SQL 选项并不是很好——我所知道的最好的事情是 L2ST4 它至少提供了更多功能控制生成的类。设计器文档是一个大而精美的 XML 文件,所以我想如果您有动力的话,您可以制作一些在外部生成它的东西。
实体框架有更好的选择——特别是因为 v 4.1 为您提供了代码优先。因此,这意味着您需要做的就是生成一个 C# 类,然后 EF 处理其余的事情。
Linq to SQL options aren't great -- best thing I know of is L2ST4 which at least gives one much more control over the generated classes. The designer document is a big, fancy XML file so I guess you could make something that generates it externally if you were so motivated.
Entity Framework has much better options -- especially since v 4.1 gives you code-first. So that means all you need to do is generate a C# class and then EF handles the rest.