prism application context

Oct 19, 2011 at 11:18 AM

here i want to ask one question perhaps not so related to prim ,

i want to design one class served as application context across prism based application ,for example  i have one domain object Group which has a children collection of type Contact ,now the ObservableCollection<GroupInfo> Groups collection live in one module ,but i want this be used all over the application in order to check some state and information .

i don't want to put it in the region context ,i suppose it should look like ThreadContext.Current .Groups ,any idea ?

ObservableCollection<GroupInfo> Groups
Oct 19, 2011 at 11:59 AM

if i use a ThreadContext class contains the public static ObservableCollection<GroupInfo> Groups and i have a XXViewModel, how should i use this Groups property to bind such as treeview or listbox ,

1 i always use XXViewModel as data context for XXView

2 should i add a ObservableCollection<GroupInfo> Groups in XXViewModel and set its value with ThreadContext.Groups or should i bind to the static value in ThreadContext?

i am new to prism and need your help :)

thank U

Developer
Oct 19, 2011 at 12:30 PM

Hi,

You might find shared services useful to fulfill your requirement; shared services are services shared among your modules by exporting them into the container, using the service's interface (which is stored in an infrastructure project referenced in all your modules) as the contract type.

You might, therefore, create a service that returns your Groups, and abstracts the way you fetch it from the server (or any other place you're obtaining the groups from). You might find this blog post useful, which shows how to do this with WCF Services:

Using WCF services in Prism Silverlight applications

I hope you find this helpful.

Guido Leandro Maliandi 
http://blogs.southworks.net/gmaliandi