views:

231

answers:

1

Hello, I don't see difference between ObjectDataSource and new DomainDataSource (http://blogs.microsoft.co.il/blogs/bursteg/archive/2009/04/11/using-domaindatasource-in-asp-net.aspx). I need create 4 methods, which is then used in both cases.

What I main difference?

A: 

One thing I'm aware of is that the ObjectDataSource doesn't work very well against "tracked" data objects. If the data object is, say, a Linq to SQL object then you need a Linq to SQL DataContext to be tracking that data object before it can be "updated" to the database. The ObjectDataSource relies on Activator.CreateInstance to build your data objects just before it tries to save them.

On an older VS2005 project I was on, we were using NHibernate as a backend (which similarly needs to be responsible for instantiating data objects) and ended up using a version of this NHibernateDataSource on our aspx pages.

It seems that the DomainDataSource intends to be usable against all kinds of DataContext powered domain models objects (I'm not going to call them POCOs ;)), Linq to SQL, Linq to Entities, Astoria, RIA services etc...

Rob Fonseca-Ensor

related questions