Reputation: 45692
I am starting to write an application in Silverlight with RIA services and SilverlightFx. Now this application is a pretty big one has has lot of interaction between controls.
As an estimate it will have around 60-70 user controls. Now my questions are..
Is it good to choose .Net Ria and SilverlightFx? (My view is..It is not going to production very soon. And as it is a big one using frameworks will help unit testing and save development time once the frameworks are understood properly.)
After reading through the blogs I am not really clear how SilverlightFx handles interaction between user controls. For example I have a user control (say "S") that have the search functionality...auto complete and all...Now I have another UserControl (Say "R") that displays the search results. The display result panel can be used from search user control or another user control (Say F) that gives all items of a particular category. I can not marge Search and Select Category into a single userontrol. So how to do it? If I create different ViewModels how they will interect with each other?
Is it better to create Domain service context in each ViewModel or to use a single one across the application?
Upvotes: 2
Views: 1077
Reputation: 5225
Note to preface answer - I am the author of Silverlight.FX, and architect for RIA Services ... so factor in bias in the reply :-) ...
I did two blog posts on the combination of the two you might find helpful: here and here. These cover basic view model scenarios using a DomainContext and basic unit testing of view models using the Silverlight Unit Test Framework.
Silverlight.FX offers more than just graphical interaction. From the site (http://projects.nikhilk.net/SilverlightFX):
The way to handle the notifications across view models would be to use some sort of event aggregator pattern that allows view models to publish and subscribe to events in a decoupled manner.
This feature isn't yet in Silverlight.FX, but is slated to go in hopefully soon. I demonstrated this sort of communication recently in my TechEd South Africa talk - check out the slides and code for an implementation of this: http://www.nikhilk.net/TechEd09-South-Africa-Samples.aspx.
Hope that helps.
Upvotes: 2
Reputation: 1922
Hey there, first off i dont know if SLFX provides any useful features besides graphical interaction, i suggest you take a look at prism for proper MVVM integration and proper use of Regions in your design, and then communication between regions (simply speaking, usercontrols but a little more dynamic in its loading)
Unit testing from SL3 interface means that you must have a means to simulate user input, there are quite a few ways todo this. One of the easiest is the MVVM approach and thereby simulating input into the viewmodel. prism support for SL3 will co-incide with the release of WPF 4.0. prism currently does support SL3 just not the navigation framework, as it clashes alot with prism's region navigation, but they perform different tasks and they dont overlap functionality.
If you have usercontrols "S", and "R" then, they both will share a common datasource, being the viewmodel, therefore properties within the viewmodel can communicate with each other, this mostly happens when the OnPropertyChanged event is fired. or a button is clicked, then using prism's commanding, you can hookup a button control click method to a method in the viewmodel.
It really depends on alot of things, such as concurrency, since all calls from SL3 are async, meaning you can shoot of 3 queries at once over the same domain context, and how many connections you want created to your WCF service. i havent used RIA enough to understand the implications of the choices you have, so i cant give you an exact answer, but the general rule is to keep db connections to a minimum (Domain context recycling does not automatically convert into less connections since WCF is stateless unless otherwise designed)
Upvotes: 0