本文介绍了库+的UnitOfWork模式的实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在搜索网向上和向下,我没能找到一个合适的设计,我的应用程序。
我找仓库+的UnitOfWork模式,将管理连接,并在完成时自动处理它们。

I was searching the net up and down and I didn't manage to find a suitable design for my application.
I am looking for Repository+UnitOfWork pattern that will manage connections and dispose them automatically when done.

我需要支持的Web应用程序,其中每个请求都会有自己的UnitOfWork和Windows应用程序,每个线程都有自己的UnitOfWork。我需要的patters中的UnitOfWork whrn请求/线程进行自动配置。我也想支持rolback的情况下例外。

I need to support both web application where each request will have its own UnitOfWork and windows application where each thread will have its own UnitOfWork. I need the patters to dispose automatically the UnitOfWork whrn request/thread is done.I also would like to support rolback in case of exception.

现在我用StructureMap,所以我不在乎,继续使用它在暗示答案。

Right now I use StructureMap so I don't care to continue use it in the suggest answers.

我需要存储库模式的原因是为了实现我需要我的所有实体的能力。我需要的UnitOfWork的原因是为了允许变动不止一个实体。

The reason I need Repository pattern is to achieve all the abilities I need to all my entities.The reason I need UnitOfWork is to allow changes in more then one entity.

我真的会并欣赏任何帮助。

I will really appriciate any help.

感谢。

推荐答案

我用这个博客作为一个很好的出发点:

I used this blog as a really good starting point:

http://www.primaryobjects.com/CMS/Article122.aspx

它开始在一开始,并提供源$ C ​​$ C在年底为您服务。它还使用StructureMap,所以它可能是有点熟悉。

It starts at the VERY beginning, and provides source code at the end for you. It also uses StructureMap, so it might be somewhat familiar to you.

这篇关于库+的UnitOfWork模式的实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 16:09