Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

help understanding EF , Transactions and Unit of Work

$
0
0

I am trying to understand transactions a little more, but I don't know how to test them, eg two people accessing the same records at the same time,so i have no realpractisein how they work.

Now i use a unit of work pattern in my solution, and it has no reference to a transaction Scope, so does it use transactions? and if so how does it work?

Now transactions as pessimitc concurrency, so are there any occations where i use both pessemtic and optomistic concurrency at the same time?

Lets say I want to assign a database record to a user, not only to update the UI to let other employees know someone if using that record but also prevent some concurrncy issues

do i:

//Start a transaction
//Get the records from the database
//Add a navigation propert to assign the employee
//save the changes

now if thats correct, at the point of me selecting the records, can anyone else select them? or change them?

if i am using a unit of work the transation points are removed does that still apply?

Now lets say i want to run other operations, if I am using a unit of work, am i right in assuming the transaction is looked until IDispose has ben run, or the IOC finisheds?

Any information would be appriciated.


Viewing all articles
Browse latest Browse all 1698

Trending Articles