I'm using RIA Services for Silverlight and I'm wondering if there's a way to get the service context an entity is attached to from the entity alone (on the client, ie with the RIA-Service domain context and entities!). This would help to implement functionality in them that need some context (the service context itself being one example) without relying on global (static) storage.
0
votes
this post shows how to get Context from an entity in EF. blogs.msdn.com/b/alexj/archive/2009/06/08/…
– Yeonho
@Yeonho That's EF, not RIA Services. :) Still good to know, although I usually do next to nothing on the actual EF, all the hairy stuff is done client-side with the entities that RIA Services makes (which is a similar, but different API).
– John
@Yeonho Of course RIA Services has a server part that deals with entities, so perhaps I should clarify my question. It really wasn't an EF question.
– John
1 Answers
0
votes
You can create many custom DomainContext instances, how you needed. You can cast it to base class (DomainContext) and store it in global storage for second use. In process of second use you should cast it to the custom DaomainContext class again. For example: ((CustomDomainContext)instance).Customers.SubmitChanges();