none
DomainDataSource with MVVM

    Question

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

     

    Wednesday, June 23, 2010 7:57 PM

Answers

  • just have a look http://jeffhandley.com/archive/2009/07/14/domaindatasourcesurvey.aspx
    Saturday, June 26, 2010 6:22 AM

All replies

  • 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 6:20 AM
  • I 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
    Thursday, June 24, 2010 10:49 PM
  • 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.

    Thanks

    Friday, June 25, 2010 3:17 AM
  • just have a look http://jeffhandley.com/archive/2009/07/14/domaindatasourcesurvey.aspx
    Saturday, June 26, 2010 6:22 AM
  • re: shibub
    >> just have a look

    So I have. What in Handley's story makes you believe the DomainDataSource must be excluded from a ViewModel?

    Thursday, July 01, 2010 4:43 PM
  • I read in some blogs saying that it is good to have the DDS in the viewmodel, so u minimize the CodeBehind.

     

    Friday, July 02, 2010 3:45 AM
  • 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.

     

    Thanks

    Saturday, July 10, 2010 7:04 PM
  • No, there is no problem (according to Jeff Handley) doing so with the latest DomainDataSource in VM:

    http://forums.silverlight.net/forums/t/169705.aspx

    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:

    http://betaforums.silverlight.net/forums/p/162198/366236.aspx



    Saturday, July 10, 2010 8:14 PM