unit-of-work

Unit of Work Pattern in .Net

Does anyone have any concrete examples of a simple Unit of Work pattern in C# or Visual Basic that would handle the following scenario? I'm writing a WinForms application in which a customer can have multiple addresses associated with it. The user can add, edit and delete addresses belonging to the customer before the customer is saved...

Appling Unit Of Work pattern

I have read in Patterns of Enterprise Application Architecture that a Unit Of Work should only be used in a single Session. So each session should have its only Unit Of Work. Can anybody tell me why I could not use one Unit Of Work for the whole application (in my case ASP.NET). thx, Lieven Cardoen aka Johlero ...

Is transactional behaviour ever needed outside of databases?

I wouldn't dare do anything complex in a database without transactions. There is nearly always a simple to use in-built command. But when you start working with other persistent data you just don't get this simple to use transaction support. Some example are file systems web services (none that I've used) Even in non-persistent data ...

RhinoCommons UnitOfWork Question with ASP.Net MVC

I'm playing around with RhinoCommons and NHibernate and I had a question about the UnitOfWork pattern. Sorry if this is a n00b question. Should the UnitOfWork be started at the very highest level (ie the controller)? Or say in the service module that the controller is calling down into? ...

Unit of work question

How should I use the unit of work pattern in the following scenario: I'm writing a winforms app. I have one screen where the user can edit a single order. On this screen, the user can open another form to select the delivery company. The user can also add/edit existing delivery companies in this child form before doing the selection. H...

UnitOfWork Implementation

Hello everybody, probably I'm too n00b to understand this, but I was reading the Gabriel Schenker http://nhforge.org/wikis/patternsandpractices/nhibernate-and-the-unit-of-work-pattern.aspx UnitOfWork implementation and I really cannot get the point. Why does the UnitOfWorkImplementor.Dispose need to forward the dispose to the UnitOfWork...

Domain Model + LINQ to SQL sample

Hello all, I wonder if there is an enterprise application sample, designed with Domain Model in the Business Logic layer and LINQ for the Data Mapper? I'm not so sure of how to use the UnitOfWork ability of LINQ to SQL in conjunction with business objects from the Business Layer. Thanks, Lucian ...

LINQ to SQL as Unit of Work

From your experience, is LINQ to SQL appropriate as a Unit of Work? is it avoidable? should I prefer, say, NHibernate or another O/RM tool? Thanks, Lucian ...

When is the last moment I can return an exception to a client in WCF?

Let's say I have this in an implementation of IInstanceProvider: public void ReleaseInstance(InstanceContext instanceContext, object instance) { try { unitOfWork.Commit(); } catch (Exception) { unitOfWork.Rollback(); throw; } finally { unitOfWork.Dispose(); } } That t...

When do i need to flush Rhino Commons UnitOfWork?

When using Rhino Commons UnitOfWork (in a UnitOfWorkApplication for ASP-MVC), I like to use the Rhino Repository static class to save entities like this: Repository<Car>.Save(new Car(Id = 1)); I find that I can then get the entity out immediately after that call using: Car car = Repository<Car>.Get(1); This works fine. However, whe...

Nesting transaction scopes for integration tests using Rhino Commons UnitOfWork

I'm trying to set up a integration test class that wraps each test in a transaction. This way I can rollback the transaction after each test instead of resetting the DB before each test. I also want to be able to use transactions in the integration tests themselves. I am using NHibernate and the Rhino Commons UnitOfWork for the the pr...

Is Unit of Work more efficient if I don't care for transactions etc?

Hi, If I have 10 database calls on my web page, and none of them require any transactions etc. They are simply getting data from the database (reads), should I still use the unit of work class? Is it because creating a new session per database call is too expensive? ...

What are the .net reference implementations of the Unit of Work pattern ?

Possible Duplicates: unit-of-work-pattern-in-net rhinocommons-unitofwork-question-with-asp-net-mvc The Unit of Work pattern is a way to keep in a context to track all the actions on your domain and to apply them all at once when your - possibly - complex logic is done. When used with an ORM (NHibernate for instance), it is cons...

Unit of Work Design Pattern

Does anyone have any good links about a practical example of Unit of Work pattern with LINQ to SQL ...

Why would I use the Unit of Work pattern on top of an NHibernate session?

When would I write a UoW implementation on top of what is already provided by NHibernate? Any real world examples? ...

Unit of Work and L2S DataContext

Hello Quick Q for you pattern experts out there. I want a Repository pattern that is de-coupled from the actual data access tech, as I've not decided on that yet and I want it to be flexible. So, this could be L2S, L2E, NHibernate, Lightspeed or anything. But I'm getting confused about this UnitOfWork thing. In the L2S world, this...

Datacontext and Unit of work

i am a newbie to Object oriented programming. I have spent 8 years as a procedural programmer. Even though Linq to Sql might not be a good choice going forward, it is still a good lightweight ORM. If I want to use LTS as my data access, and I have a MVP Pattern for my UI, than my question is as follows In an MVP Pattern you typically cr...

Singleton Per Call Context (Web Request) in Unity

Hi, A few days ago I had this issue with ASP.Net threading. I wanted to have a singleton object per web request. I actually need this for my unit of work. I wanted to instantiate a unit of work per web request so that identity map is valid through out the request. This way I could use an IoC to inject my own IUnitOfWork to my repository...

UnitOfWork pattern and atomic operations

Hello I'm not 100% sure that I've implemented my Repository and UnitOfWork patterns correctly, but then I can't see how else this will work. For example, I have two objects, Apple and Orange. Apple is joined to Orange via an OrangeID like so: public class Apple { public int OrangeID { get; set; } } I want to create a new Apple a...

What design pattern to locate my IUnitOfWork?

I've implemented a repository pattern with persistence ignorance. The repository implementation only interacts with my entity objects, IUnitOfWork and ITable<T> interfaces. The intention is that the IUnitOfWork isn't reused but represents a single transaction. So far, I've implemented in-memory as well as Linq-to-Sql versions of the IUni...