For those of you that are using my Cinch MVVM framework framework I have some very good news for you. This weekend I did a lot of work to the framework inÂ preparation for a massive overhaul I am just about to give Cinch to allow .NET 4/VS2010 / MefÂ support.
The changes for .NET 4/VS2010 / MefÂ support represent what I deem to be a new codebase, so that is bad news as there will be some breaking changes for current users, but I think the new version of Cinch will be a superior framework to use. And I expect it will be a while before most people make the jump to .NET 4/ vs2010 anyway.
The good news, is that I have made a lot of changes to Cinch V1 (WPF only) this weekend, which are as follows:
- Made it so default Simple Logging Facade based logger, can be swapped out for another ILogger based logger, which will allow the dependency on Slf.dll to be removed if you do not choose to use SLF and instead write your own ILogger implementation and inject that. SLF is the default though, so for now Cinch has a dependency on SLF.
- Made a new interface called IIOCProvider which allows the IOC Container to also be swapped out. The default is Unity, and Cinch currently uses a UnityProvider, again if you wish to write a IIOCProvider and pass that into the new Cinch base ViewModel constructors, you will be able to remove the dependency on Unity. Â Unity is the default though, so for now Cinch has a dependency on Unity.
- Gave the Mediator a massive overhaul, so it now allows lamda registration/unregister. It also providesÂ asynchronousÂ NotifyCollegues methods. There is also a Mediator singleton which may be accessed using the Mediator.Instance singleton. The ViewModelBase class does a register on construction and unregister on Dispose.
- Changed the MediatorMessageSinkAttribute, so that users no longer need to specify the parameter type. This is a breaking change, sorry. The Cinch V1 demo code shows the new way of dealing with the Mediator attributes.
- Altered the way the IUIVisualizer service is initialised. This is now done with a callback Action<IUIVisualizerService> delegate. This is a breaking change, sorry. The Cinch V1 demo code shows the new way of dealing with the IUIVisualizer service.
- Provided properties in ViewModelBase for IsLoaded/IsUnloaded/IsActivated/IsDeactivated. Though overriders if the virtual view lifetime methods will have to remember to call base methods in order Â for these new properties to work
- Made various other small changes, basically I tried to do all oustanding issues/discussions and patches from the Cinch codeplex site.
So that should help those using VS2008, these changes are available right now
So what have I got in store for you with the next version, well I plan to get rid of 3rd party IOC containers entirely and use MEF. There will also be much much better Blend support, and design time data considerations will be paramount in what I am trying to achieve.
The view lifecycle attached commands will also be made into a ViewAware service that the viewmodels can use.
This is going to be a big set of changes, and I will also be trying to get this all to work for Silverlight 4 and upwards too, so it could take me a little while, but I am looking into it.
In the mean time I will update all the existing Cinch codeproject articles.
NOTE : One thing to note is that when you download Cinch after I have it all working it will contain
- V1 which is targeted at Vs2008 and WPF only
- V2 which is target at Vs2010 and will be for WPF and SL
Stay tuned, I will be writing a series of articles on Cinch v2 when I have it done.