开发者

ObjectDataSource vs new DomainDataSource

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜