unit-of-work

NHibernate: At what scope I should use transaction?

房东的猫 提交于 2019-12-20 06:48:46
问题 I am developing Data Access Layer using NHibernate. It will be used in my Business Logic Layer. My application is collection of multiple other applications (ASP.NET MVC, Windows Services, Windows Forms, ASP.NET Web API) those all will use same Business Logic Layer. Business Logic Layer will access Data Access Layer. Applications will NOT access Data Access Layer directly. I am aware that I should NOT depend on implicit transaction and should include all database calls (including READ calls)

Ninject UnitOfWork confusion

独自空忆成欢 提交于 2019-12-20 05:46:08
问题 I use Ninject all the time with my MVC 3 applications, but I'm trying to change the Pattern for my Data Objects to use UnitOfWork and I'm having trouble figuring out how to get Ninject to handle this properly. I know my implementation of classes work when they are constructed manually like this in my console application: IDatabaseFactory factory = new DatabaseFactory(); IUnitOfWork worker = new UnitOfWork(factory); IBlogCategoryDao dao = new BlogCategoryDao(factory); IBlogCategoryService

How is the Unit of Work used with batch processing?

半城伤御伤魂 提交于 2019-12-20 05:45:05
问题 When building a web application, it is a standard practice to use one Unit of Work per HTTP request, and flush all the changes and commit the transaction once after handling the request. What approach is used when building a batch process? Is one Unit of Work instance used for the whole execution of the process, with transactions committed periodically at logical points? This may be more of a discussion than a factual question, but I'm hoping to find out if there is a commonly-accepted "best

How to implement Unit of work in MVC: Responsibility

房东的猫 提交于 2019-12-19 17:38:30
问题 Who has the responsability Who has the responsibility to start and finish the Unit of work in a MVC architecture? 回答1: It's not a responsibility of a controller, it violates SRP. Controller should not even know about UoW at all. In web, one UoW per request to server is usually used. In this case UoW should be disposed at the end of a request and started somewhere after the beginning of a request (ideally start of a UoW should be lazy). The best place to do this is Global.asax (or your

Implementing UnitOfWork with Castle.Windsor

纵然是瞬间 提交于 2019-12-18 10:46:15
问题 Simple question. How do I use UnitOfWork with Castle.Windsor, nHibernate, and ASP.NET MVC? Now for the extended details. In my quest to understand the UnitOfWork pattern, I'm having difficulty coming across anything that uses a direct example in conjunction with Castle.Windsor , specifically in regards to the way it needs to be installed. Here is my understanding so far. IUnitOfWork The IUnitOfWork interface is used to declare the pattern The UnitOfWork class must Commit and Rollback

Using DTO to transfer data between service layer and UI layer

烈酒焚心 提交于 2019-12-18 10:12:38
问题 I've been trying to figure this out for days but there seems to be very little info on this particular subject with ASP.NET MVC. I've been Googling around for days and haven't really been able to figure anything out about this particular issue. I've got a 3 layer project. Business, DAL and UI/Web layer. In the DAL is dbcontext, repository and unit of work. In the business layer is a domain layer with all the interfaces and the EF models. In the business layer there is also a service layer

Symfony2 / Doctrine2 throwing index error when flushing the entity manager

眉间皱痕 提交于 2019-12-18 02:47:32
问题 Three entities are involved here: Deployment , DeploymentStep , and DeploymentStatusLog . I'll start by pasting the relevant definitions of those classes src/My/Bundle/Entity/Deployment.php <?php namespace My\Bundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\PersistentCollection; /** * @ORM\Table(name="deployment") * @ORM\Entity() */ class Deployment { /** * Status Log Entries for this deployment * * @var \Doctrine\ORM

Using Unit of Work design pattern / NHibernate Sessions in an MVVM WPF

◇◆丶佛笑我妖孽 提交于 2019-12-17 18:24:24
问题 I think I am stuck in the paralysis of analysis. Please help! I currently have a project that Uses NHibernate on SQLite Implements Repository and Unit of Work pattern: http://www.nhforge.org/wikis/patternsandpractices/nhibernate-and-the-unit-of-work-pattern.aspx MVVM strategy in a WPF app Unit of Work implementation in my case supports one NHibernate session at a time. I thought at the time that this makes sense; it hides inner workings of NHibernate session from ViewModel. Now, according to

Decouple unit of work from services or repo

坚强是说给别人听的谎言 提交于 2019-12-17 15:35:11
问题 I am trying to decouple my unit of work from my services or repository so that I wont have to touch the UoW code whenever I wish to add a new service. How do I do this? _categoryService = _unitOfWork.Get<ICategoryService>(); so instead of _unitOfWork.CategoryService.Add(category) I can just say; _categoryService.Add(category); 回答1: I am trying to decouple my unit of work from my services or repository so that I won’t have to touch the UoW code whenever I wish to add a new service Well, that’s

Entity Framework 6 and Unit Of Work… Where, When? Is it like transactions in ado.net?

走远了吗. 提交于 2019-12-17 10:19:50
问题 Creating a new MVC project and like the idea of repositories in the data layer, so i have implemented them. I have also created a Service layer to handle all business logic and validation, this layer in turn uses the appropriate repository. Something like this (I am using Simple Injector to inject) DAL LAYER public class MyRepository { private DbContext _context; public MyRepository(DbContext context) { _context = context; } public MyEntity Get(int id) { return _context.Set<MyEntity>().Find