Print Page | Close Window

DevForce MEFedMVVM Reference SL App

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1937
Printed Date: 21-Apr-2026 at 3:49pm


Topic: DevForce MEFedMVVM Reference SL App
Posted By: DavidKozikowski
Subject: DevForce MEFedMVVM Reference SL App
Date Posted: 02-Jul-2010 at 9:40am

I have been using DevForce with MEFedMVVM and thought I would share this reference app.

Hoping someone can take it add some more functionality. This is using MEFedMVVM for Dependency injection. This framework is “Blendable”   serving up design time data in Blend and runtime data is VS based on the Injected services. This is also using the Navigation Framework (other ways welcome)

 

If you have not seen MEFedMVVM this is a good example of how you can use it, very simple and clean.

On another note with regards to a Repository I’m hoping someone that has a good understanding of this Design pattern and DevForce can maybe take add and share it as well.

 

I have removed all the bin and obj file for a small DL you will have to recompile it is using the NorthwindIB on a local instance to make it easy.

 

Hope someone will find this sample helpful. And we as a community can really make good template to use for our DevForce SL assignments.

Feel free to pick a task and pitch in J

Next Tasks:

Create VS templates for adding a new View , ViewModel and Repository items to the solution.

Add Save, update, delete, Search/query support

Add a Repository.

Add a Login.

Add a Busy Indicator.

Get a real View by someone that knows Blend.

Look Into a Prism v2.2 Composite version.




Replies:
Posted By: DavidKozikowski
Date Posted: 05-Jul-2010 at 6:14am

Version 1.1.1

 

Added Singleton Pattern for getting the manager.

Changed naming of Interfaces and Services to better describe their functions.

 
*New Version Below*

 

 

http://www.ideablade.com/forum/uploads/672/DevMEFedMVVMReferenceSL_v1.1.0.zip -  
 


Posted By: DavidKozikowski
Date Posted: 08-Jul-2010 at 9:34am

Includes a working “Busy Indicator” on the CustomersView.

* New Version Below * http://www.ideablade.com/forum/uploads/672/DevMEFedMMVMReferenceSL_v1.1.2.zip -
 
Not sure what will be next :)
 


Posted By: DavidKozikowski
Date Posted: 09-Jul-2010 at 7:27am

This version only changes the layout of the datagrid. I wanted to remove some columns but could not use the designer. So I found the below Solution in another Ward Bell post, I copied the piece here so you would not have to look for it. Once grid is linked to the object you can delete the datasouce object in you solution as the designed will still work. Maybe the folks at DevForce can make something that will make this step obsolete.

 

I’m still not happy about how to raise events in the DataModel that make their way to the View.

I would like to raise an event in the model when the manager starts the fetch and then another one when it’s done. I know that the manager has events and I’m doing the following in the ViewModel works like a champ but I can’t seem to raise the event in the Model , so I’m getting the Singleton instance of the manager in the ViewModel constructor and doing it there, it works but my guess is there is a “better” way

 

  _entityManager.Fetching += delegate { IsBusy = true; };
  _entityManager.Queried += delegate { IsBusy = false; };

 

The Binding between the View and ViewModel is clean and straightforward so I’m wondering what should really be in the ViewModel compared to the DataModel.

Looking for anyone that has used a MVVM pattern with DevForce for their solution of how they decouple the layers.

The DevForce Silverlight Project will place all the shared code in the um Shared Code Folder.

I wonder if there is a way that there could be a Model folder under the shared code folder.

Maybe I just move them as they are only generated once.

 
 
begin Ward Post
*************************************************************************************
Here's a recipe that works for me. I just tried it as a modification of our "DevForce Silverlight Tour" application.
  • Build your solution (or you won't see the model project)
  • Open the xaml class file (can be in either XAML or Designer view)
  • Open the Data Sources window
  • Click "Add New Data Source"; Data Source Configuration Wizard dialog opens
  • Pick the "Object" data source type
  • Open the node to the project with your model (if not shown, you may have forgotten to build)
  • Check the checkbox(es) next to the entities you'll be binding (e.g, Customer, Employee)
  • Click "Finish" button

They should appear in the Data Sources window ... after a pause.

They frequently disappear from the window and it takes awhile (a long while) for Visual Studio to rebuild that window. You will notice that the window rebuilds itself (painfully) seemingly on a whim.
 
Note that the data sources you created are listed in the DataSources folder under your project's Properties folder
  • Twiddle with your Data Source to get it the way you want it (see any demo)
  • Drag source on to canvas (see any demo)
  • REPAIR !!!

You will almost certainly need to go into the XAML to deal with the junk piled into it.

The generated CollectionView resource is useless to me because I use MVVM. It may be that I just don't know how to use it properly. If I seem less uninterested in it ... that's because I am. You're welcome to follow your own star on this.
 
Anyway, for me, the CollectionView has done its job and so I soon delete it and the StaticResource binding of the DataGrid (DG)'s or DataForm (DF)'s DataContext to that CollectionView.
 
I bind DG or DF ItemsSource to the relevant collection property (typically an ObservableCollection<T>) of the ViewModel (e.g,. "vm.Employees").
 
 
*********************************************************************
End Ward post
 
http://www.ideablade.com/forum/uploads/672/DevMEFedMMVMReferenceSL_v1.1.3.zip - uploads/672/DevMEFedMMVMReferenceSL_v1.1.3.zip


Posted By: DavidKozikowski
Date Posted: 20-Jul-2010 at 7:40am
I am looking at this article
 
http://msdn.microsoft.com/en-us/magazine/ff798279.aspx - http://msdn.microsoft.com/en-us/magazine/ff798279.aspx
 
Thinking about it all stay tuned.
 



Print Page | Close Window