开发者

ObjectDataSource vs new DomainDataSource

开发者 https://www.devze.com 2022-12-10 19:48 出处:网络
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 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?


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消