Paul said:
Hi,
It seems that the DataContext is not allowed to work in memory and
insert all changes made to the database until the end.
I think to work in memory dataset is better, right?
Let's make sure we are understanding that DataSets and contexts are not
corollaries. LINQ objects and a DataSet correlate to an extent, but a
DataContext does not.
As for what is better to use? I would say DataSet with a TableAdapter, if
you gave me these choices. But I find LINQ to SQL to be so anemic that it is
a worthless technology for most of the applications I work on. I love LINQ,
as LINQ, but as soon as you start using it for data access, you are trading
a good abstraction for very poor performance. Note that I am dealing more in
the Enterprise space. If you are dealing with small business and personal
sites, you might find LINQ to SQL will work for you.
I would be more inclined to look at EF (which can be used with LINQ in the
middle tier) or even custom models with a Repository pattern.
NOTE: DataSets, while a bit heavy, actually work rather nicely and decouple
the access from the model. I am not against them, if you are familiar with
them. I suggest you reduce any perf penalty by using strongly typed
DataSets, of course. This is not my preference, as I like thinner models,
but it works. And, I have used them in organizations that are very used to
DataSets.
Hope this helps!
--
Peace and Grace,
Greg
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
************************************************
| Think outside the box! |
************************************************