SilverlightShow: Silverlight WCF RIA Services: Strategies for handling your Domain Context - Part 1 Comments http://www.silverlightshow.net/ Silverlight articles, Silverlight tutorials, Silverlight videos, Silverlight samples SilverlightShow.net http://www.rssboard.org/rss-specification Argotic Syndication Framework 2008.0.2.0, http://www.codeplex.com/Argotic en-US estoychev@completit.com (Emil Stoychev) RE: Silverlight & WCF RIA Services: Strategies for handling your Domain Context - Part 1 <p>Hi,</p> <p>Part 2 of this article demonstrating the second and third approach is available at <a href="http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-two.aspx">http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-two.aspx</a></p> <p>Have a nice reading :)</p> <p>SilverlightShow Team</p> http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx#comment5889 SilverlightShow http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx Tue, 12 Apr 2011 10:15:58 GMT RE: Silverlight & WCF RIA Services: Strategies for handling your Domain Context - Part 1 Part 2 and 3 please please please!!! I currently have a thread running on the silverlight forum about this exact issue. I went with the global domain context, but since you cant perform a load operation while you have changes, I am constantly struggling with saving the context in time. Since I am trying to move my app to a tabbed browser like interface, with multiple copys of views loaded they need to have their own domain context - well view model actually, but I want to be able to save individual changes. Very excited to hear about option 3, thats something I have spent many days pondering http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx#comment5885 rknell http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx Tue, 12 Apr 2011 04:26:30 GMT RE: Silverlight & WCF RIA Services: Strategies for handling your Domain Context - Part 1 <div style="padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; background-image: none; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; text-align: left; word-wrap: break-word;"> <p>Adam, Solve: glad you liked the article / to have been of help :-)</p> <p>Matt: with this approach, you would indeed get multiple copies of "the same" entities (possibly: one for each domain context instance).  An entity can only be tracked by one domain context instance, so these "copies" must be made - if you're using the "multiple domain context instances" approach, you will have to have an entity instance of each entity for each domain context (if the entities are to be used by both).  If you do not want these copies, you might want to take a look at the second part of this article series.  </p> <p>Technically speaking, these aren't exact copies: you're making a copy to start from (just to keep the contexts in sync), but after that, the entities could easily change between VM's/context instances. Eg: an advantage could be the case where the "same" entity has client side properties that are, and should be, different between ViewModels.</p> <p>As usual, the "best" approach will depend on the requirements of your app.</p> </div> http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx#comment5746 KevinDockx http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx Mon, 21 Mar 2011 11:21:48 GMT RE: Silverlight & WCF RIA Services: Strategies for handling your Domain Context - Part 1 <p>I am curious about the affect on performance and memory consumption using Strategy 1.  It seems like having a new instance of the Domain context in every viewmodel could cause duplicate copies of data througout the application and increase the CPU usage.  </p> <p>For instance if I have aViewModel that has a collection with hundreds of items in it, and other views that need that same collection, is there a good way using Strategy 1 to share data across ViewModels, or across Domain Contexts so you don't have to load 2 copies of the same collection in different pages.</p> http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx#comment5728 Matt http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx Fri, 18 Mar 2011 18:51:49 GMT RE: Silverlight & WCF RIA Services: Strategies for handling your Domain Context - Part 1 Thanks for a very well written part one, I'm really looking forward to part two.<br /> PS: I'm planning to use more sharing in my current project. <br /> http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx#comment5724 Sølve http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx Thu, 17 Mar 2011 22:16:29 GMT RE: Silverlight & WCF RIA Services: Strategies for handling your Domain Context - Part 1 <span style="font-family: calibri;">I look forward to the next!  I had faced this exact issue with my last project.  I went with your first approach from this page, multiple contexts. I also reload the data between screens too however (no sync).  Halfway into the app I realized that if I had a single context I'd not need to do this, and could have a master save button.  The user experience would have been better but I would have had to add code to navigate back to specific pages with errors if they came up during save.   With the approach you listed here, the user is on the page with the data necessary to deal with any errors generated when they save. (At least in my case)</span> http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx#comment5723 Adam http://www.silverlightshow.net/items/Silverlight-WCF-RIA-Services-strategies-for-handling-your-Domain-Context-part-one.aspx Thu, 17 Mar 2011 16:59:36 GMT