Prism model modularity

Topics: Prism v4 - WPF 4
Dec 30, 2010 at 2:55 PM


We’re planning to develop a completely new application using Prism. So I started reading the Prism documentation on the Codeplex site. Most of the things are clear except for one thing. What if there’s a model object which has to be shared amongst different modules? Should an interface be created containing the “shared” functionality needed by the modules or should a reference to the assembly containing the model be created ?

Any help is appreciated!

Dec 30, 2010 at 3:21 PM

The direction I have gone with my app, was through the use of the EFv4 and then creating an EntityService class and an interface respectively.  The entire entity model is contained in its own project, it is referenced by the infrastructure and shell projects. 
I also use a controller pattern to initialize the Entities with MEF exports.   The 3 individual modules have references to the Data project as well for model access.  I don't know if this is the best way but it works at present.  Using observablecollection<T>, and some additional partial classes in the EF data project I take advantage of the data validation which bubbles up thru and into the views.

Dec 30, 2010 at 3:32 PM

Wow thanks for the quick reply.

The EFv4 is something we're considering to use. Does this mean that the entity model project contains all the model data for the complete application? It does look like a usable solution, maybe there isn't another good alternative.

Dec 30, 2010 at 4:14 PM

There are always alternatives but I wanted to give EF a try since they did some amazing updates to it... Recently reading they are about to release another version soon that is more POCO based so if you already have the database made you can do a code first approach which wouldn't necessarily increase the code work but make it more readable.  at least from the examples I have seen so far.  DataAnotations could then be used for input validation which they have taken time fully support.

In answer to your question, yes all model information is in a singular project for the complete app.