Question

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

Was it helpful?

Solution

The Linq to Sql data context is designed to be used for a single unit of work.

Edit: to add references.

The Linq To SQL FAQ:

Q: Should I create a new DataContext in every business logic method?

A: The DataContext conforms to the Unit of Work design pattern. Unless you are moving data between physical tiers between each operation you should keep your DataContext alive for the duration of work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top