Hi David,

We are using RIA and a standard ViewModel takes an IRepository<T> where T : 
Entity.
When I want to track lists of items I use ObservableCollection<T> as well and 
add it to the EntitySet if I want it commited to the database.
Under the hood, an IRepository<Product> and IRepository<Category> will use the 
same domain context however we are in the process of adjusting this to use the 
same domain context only per ViewModel (ie unit of work) and this is managed by 
the IOC container.

However I never really need to create NEW entity sets and was unsure how to 
answer your question. Usually with .Include("Products") you would get all the 
products with a category, or at least an empty entity set if there are none, 
and you can still add to that existing entity set on the Category entity.

Steven Nagy
Readify | Senior Consultant
M: +61 404 044 513 | E: steven.n...@readify.net<sip:steven.n...@readify.net> | 
B: azure.snagy.name<http://azure.snagy.name/>

From: ozsilverlight-boun...@ozsilverlight.com 
[mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of David Burela
Sent: Thursday, 2 September 2010 4:45 PM
To: ozSilverlight
Subject: Re: Decoupling from RIA services

Answer: Just hack it out and use an ObservableCollection instead.

On 2 September 2010 14:10, David Burela 
<david.bur...@gmail.com<mailto:david.bur...@gmail.com>> wrote:
I am working on a new Silverlight application.
It is a standard MVVM application using RIA services to retrieve the data.

I am trying to not have the domain service in my ViewModel, and I have managed 
to get 99% of the domain context out.
The only thing that I am just left with, is a EntitySet<> as the base of one of 
my collections, which I'm not too worried about. But for testing, etc. I need 
to be able to new up one of these.

When i go
var entityset = new EnitySet<Products>();
It does create a new EntitySet. However, it doesn't initialise it's internal 
list. So when I try to add items to it in my tests the whole thing throws null 
reference exceptions. Does anyone have a way of creating EntitySets client side 
so I can have everything decoupled from my domain context?

-David Burela

_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to