简体   繁体   English

实体框架UOW模式和存储库的样板资源(如果需要)

[英]Boilerplate resource for Entity Framework UOW pattern and repository if needed

I want to decouple the domain logic entirely from the persistence layer in my next project. 我想在下一个项目中将域逻辑与持久层完全脱钩。 However, I am reading conflicting reports as to the optimal approach. 但是,我正在阅读有关最佳方法的矛盾报告。

Basically the gist I am getting is forget trying to implement a generic repository and classic UOW as Entity Framework 5 and above are already built on UOW and repository pattern. 基本上,我得到的要点是忘记尝试实现通用存储库和经典UOW,因为Entity Framework 5及更高版本已经基于UOW和存储库模式构建。 Doing so would complicate the application and not provide any genuine isolation from entity framework. 这样做会使应用程序复杂化,并且不会提供与实体框架的任何真正隔离。 Rather, just abstract the context away with an application layer interface and employ some solution to map domain/view models to their respective entity classes before passing them to the context for saving. 相反,只需使用应用程序层接口将上下文抽象化,并采用某种解决方案将域/视图模型映射到它们各自的实体类,然后再将它们传递给上下文进行保存。

I saw some short, incomplete extracts on how to do this here and there, but I would ideally want to be able to get my hands on a simple, well made project (pref WebAPI oriented) that makes use of all the approaches discussed above. 我在这里和那里看到了一些简短,不完整的摘录,但是理想情况下,我希望能够接触到一个简单,制作精良的项目(面向WebAPI的首选),该项目利用了上面讨论的所有方法。 In general I don't know of any good boilerplate resource for .NET stuff, other than the projects on asp.net and they seem to be far too simplistic and not adopting the conventions you'd find in practice. 总的来说,除了asp.net上的项目外,我不知道任何适用于.NET东西的好的样板资源,它们似乎过于简单,没有采用您在实践中发现的约定。

Mainly used this post as source. 主要将此帖子用作源。

It may be good to check my article: http://www.codeproject.com/Articles/768664/Introduction-to-ASP-NET-Boilerplate 最好检查一下我的文章: http : //www.codeproject.com/Articles/768664/Introduction-to-ASP-NET-Boilerplate

ASP.NET Boilerplate is a starting point for new modern web applications using best practices and most popular tools. ASP.NET Boilerplate是使用最佳实践和最流行工具的新现代Web应用程序的起点。 It's aimed to be a solid model, a general-purpose application framework and a project template. 它旨在成为一个可靠的模型,一个通用应用程序框架和一个项目模板。

Using ABP, you will have a good infrastructure to implement layered, domain driven design model. 使用ABP,您将拥有一个良好的基础结构来实施分层的,域驱动的设计模型。

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

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