Wednesday, June 23, 2010 7:57 PM
is it good to have a DomainDataSource object inside the ViewModel Object, so I can benefit from all the features of DomainDataSource (filtering , paging, ...)
I need detailed reviews and explanations about this topic please.
Thank you for help.
Thursday, June 24, 2010 6:20 AM
It really depends on your application. I don't think there's an "established best practice." Because of the short-lived nature of data access technologies, I always like to abstract the layer. So my view model would talk to an interface that provides entities, and then I can "hide" the interaction with domain services behind that. Then, if I swap out how it's done in the future, no problem.
However, this does add another layer that isn't always needed and creates extra work. If you are fairly certainly of the lifespan and technologies related to your application, then it may make sense to take advantage of the rapid development that WCF RIA affords and go ahead and have your ViewModels plug right into it - that's the beauty of an agile software process: you can always refactor and abstract it later when and if there is a need.
Thursday, June 24, 2010 10:49 PMI dont think this is the good idea to have to DomainDataSource object inside ViewModel.... and if you really want to take advantage of filtering , paging then i suggest you use DomainDataContext in ViewModel
Friday, June 25, 2010 3:17 AM
Thanks for answering,
But why it is not good to have DomainDataSource object inside ViewModel. Can you explain please.
The domainDataSource already gives you advantages of dynamic filtering and sorting and other features without a lot of work on your side.
Saturday, June 26, 2010 6:22 AMjust have a look http://jeffhandley.com/archive/2009/07/14/domaindatasourcesurvey.aspx
Thursday, July 01, 2010 4:43 PM
>> just have a look
So I have. What in Handley's story makes you believe the DomainDataSource must be excluded from a ViewModel?
Friday, July 02, 2010 3:45 AM
I read in some blogs saying that it is good to have the DDS in the viewmodel, so u minimize the CodeBehind.
Saturday, July 10, 2010 7:04 PM
Any body can help.
I need to know if it is bad or good to use DomainDataSource in The ViewModel . Is there a problem in doing so.
Saturday, July 10, 2010 8:14 PM
No, there is no problem (according to Jeff Handley) doing so with the latest DomainDataSource in VM:
There were problems while in RIA preview stage. Because DomainDataSource was originally designed to be used in XAML, Some function didn't even function right if it was not in XAML. We had a lot of discussions on this forum about this such as this one: