I am experiencing some odd behaviour with NHibernate. I'm retrieving a list of Learners from a repository, updating them as necessary, the odd thing is when I save the first one, the changes made to all the learners are being commited to the database.
[Transaction]
public void UpdateLearner(Learner learner)
{
...
Very new to FluentNHibernate, but I'm also excited about the area. I've recently started work on a new DAL using the aforementioned and have been reading up on the Repository pattern. I like the generic form this pattern takes and am looking to use this pattern in conjunction with the UnitOfWork pattern for session management.
I'm curio...
I need to design and implement something similar to what Martin Fowler calls the "Unit of Work" pattern. I have heard others refer to it as a "Shopping Cart" pattern, but I'm not convinced the needs are the same.
The specific problem is that users (and our UI team) want to be able to create and assign child objects (with referential in...
Although I'm not doing full blown DDD, I find the repository pattern appealing and I do try to segment the repositories along aggregate-root boundaries. I'm implementing repositories on top of the Entity Framework, and here the ObjectContext allows for a unit-of-work style as it tracks changes to the entities and will generate the appro...
Hi everybody,
I'm going to write my own DAL in C#. I decided to use 'Unit of Work' pattern (next mentioned as uow) with request as a scope and Identity map stored in HttpContext.Items.
I have right now question about implementing of CRUD methods. How/where are they implemented? Are they implemented in every single business class (as in...
There seems to be lots of examples on implementing Repository pattern for Linq to SQL. Most of them featuring IRepository and DI; Some have implemented Unit of Work and some not. I tried to read as most of the results returned by searches on SO and Google on Linq to SQL repository patterns. Nevertheless I've not come across a complete so...
Hi There
I have been using the ncommon framework (http://code.google.com/p/ncommon/) with nhibernate and asp.net mvc. I really like the implementation of the unit of work pattern, but am having problems with lazy loading in my views. I am looking how to implement the session per request pattern with ncommon or look at another framework ...
I have seen unit of work pattern implemented with something like a following code:
private HashSet<object> _newEntities = new HashSet<object>();
private HashSet<object> _updatedEntities = new HashSet<object>();
private HashSet<object> _deletedEntities = new HashSet<object>();
and then there are methods for adding entities ...
I just implemented the async pattern in a wcf service, when i received the error message: You are not in a unit of work. I knew I had this message before but didn't know exactly what I did back then.
So I did some experimenting and just called the UnitOfWork.Start(). This solved the issue.
However now I am wondering..is this a good solut...
Hi,
I'm looking for some advice for the following.
I need to create a DAL that is interchangeable between a database and a webservice.
I'm developing in C# and WPF.
has anyone see any good implementations of an IUnitOfWork and allows different DAL to be switch in or out using some sort of DI?
EDIT
So after doing some reading. I'...
I have been looking at this excellant blog titled "NHibernate and the Unit of Work Pattern" and have a question regarding the best place to use UnitOfWork.Start in a asp.net mvc project.
My SLN is broken down into the following projects:-
MVC project
Repository
NHibernateUnitOfWork
I have an interface:-
public interface INameRep...
I have a repository pattern setup using NHibernate. The base class looks like this:
public interface IUnitOfWork : IDisposable
{
void Commit();
void Rollback();
}
// generic NHibernate implementation of IUnitOfWork here
public class NHibernateRepositoryBase<T> : IRepository<T>
{
private NHibernateUnitOfWork _unitOfWork;
...
Who has the responsability
Who has the responsibility to start and finish the Unit of work in a MVC architecture?
...
Hi,
I have a certain scenario where inserts and updates are done on multiple tables based on some constraints ..so its natural to use Transaction scope for these scenarios.Now,I have a respository layer and a service layer. service layer mediates the repository and the UI and is persistent ignorant.
Now i m confused where to use the tran...
Hi,
We are about to start up a new project similar to a previous one. I could just copy the old design but I am not all too satisified with the old design.
It is a "standard" business system (sales,stocktaking,warehousing etc) built ontop of .Net 3.5 (Winforms MDI) with Entity Framework in the backend.
All forms inherit from a basefo...
(apologies for the Wall Of Text... :) )
Summary
Using Dependency Injection with my Winfor application is creating a large number of Repository Context's. I'm not sure if the way i'm using this is right or wrong, or what the common practice is.
Details
In the last 6 odd months, I've been making ASP.NET MVC applications that impliment...
I'm trying to implement the Unit of Work/Repository pattern, as described here:
http://blogs.msdn.com/adonet/archive/2009/06/16/using-repository-and-unit-of-work-patterns-with-entity-framework-4-0.aspx
This requires each Repository to accept an IUnitOfWork implementation, eg an EF datacontext extended with a partial class to add an IUni...
nobody loved my first question about this:
http://stackoverflow.com/questions/2407636/creating-entity-framework-objects-with-unity-for-unit-of-work-repository-pattern
so I've managed to rephrase it to something you can read without falling asleep/losing the will to live.
I'm creating an object, DataAccessLayer, that takes 2 interfaces ...
Hi folks,
I've got the following deadlock graph that describes two sql statements that are deadlocking each other. I'm just not sure how to analyse this problem and then fix up my sql code to prevent this from happening.
Main deadlock graph
Click here for a bigger image.
Left side, details
Click here for a bigger image.
Right sid...
I have the following code which is in a transaction. I'm not sure where/when I should be commiting my unit of work.
On purpose, I've not mentioned what type of Respoistory i'm using - eg. Linq-To-Sql, Entity Framework 4, NHibernate, etc.
If someone knows where, can they please explain WHY they have said, where? (i'm trying to understan...