WPF, Prism4, Entity Framework 4, MVVM, MEF Sample

Topics: Prism v4 - WPF 4
Dec 12, 2010 at 11:01 AM

Quick start for prism 4 does not have examples of connecting to database using Entity framework. 4. Can Prism team or a prism user can provide some sample application or tutorial how to do so.

Thanks in advance for help.

Dec 12, 2010 at 9:48 PM
Edited Dec 12, 2010 at 9:50 PM

I am using a service I put into my infrastructure project, that connects to the Data Library. Also, created a controller for the application and the entity, to facilitate initialization. Then inject via the viewmodel and bind accordingly.

public interface IEntityService{

   //miscellaneous methods / properties


public class EntityService : IEntityService{

   //implementation of IEntityService


For validation handling I created partial classes in a separate file for each entity and make the necessary overrides for handling null/length and RegEx input validation. Since they are partial, they are part of the entity, examples can be found by searching for Beth Massi and EF Validation in WPF, a whole series of videos will appear and you can search more out on this if you need.

Hope this helps.