最优雅的 C# .NET 数据访问层设计是什么?
我想知道什么被认为是生成数据访问层的最优雅的 C# .NET 方法?
我正在使用 MyGeneration DooDads。这是一个优雅的解决方案吗?
是否仍然可以使用 CRUD 存储过程 + DAL 库通过 .NET Entity Framework 和 NHibernate ORM 工具进行数据访问?
I would like to konw what is considered the most elegant C# .NET method to produce a Data Access Layer?
I am using MyGeneration DooDads. Is this an elegant solution?
Is it still acceptable to use the CRUD Stored Procedures + DAL Library for data access with .NET Entity Framework and NHibernate ORM tools?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试将领域模型与 ORM(Linq 或 Nhibernate)一起使用。 Visual Studio对Linq有很好的支持,很容易配置和使用。所有数据访问方法都封装在域对象(数据表对象)中,所有查询结果都是强类型的。
You can try to use domain model with ORM (Linq or Nhibernate). Visual Studio has a good support for Linq, it is easy to configure and use. All data access methods are encapsulated in the domain objects (data table objects) and all the query result is strong typed.
这个问题没有答案;每个人都有不同的意见。
就我个人而言,我喜欢在简单的家庭项目中使用 ORM,但不会在我实际必须支持的应用程序中使用 ORM,并且更喜欢使用存储过程为数据库提供一个从存储机制中抽象出来的定义良好的接口。
很多人不同意这个观点。哎呀,几年后即使是我也可能会不同意。但我的想法或他们的想法并不重要,如果你对你正在做的事情感到满意,并且发现它编码高效且易于支持,那么它就是优雅的。
There is no answer to this question; everybody has different opinions.
Personally I like ORMs for simple home projects but wouldn't go near one in an application I actually have to support, and much prefer to use stored procedures to give the database a well defined interface that is abstracted from the storage mechanism.
Many people disagree with this point of view. Heck, even I'll probably disagree with it in a few years time. But it doesn't really matter what I think or what they think, if you're happy with what you're doing and find it efficient to code and easy to support, then it's elegant.