We are going to be developing a large enterprise desktop application very soon and i have been spending some time researching the WPF + PRISM + MVVM approach, i have got a good grasp on most of the concepts and am loving the modularity it provides.
Where i am having problems is with how to architect the services layer to get data in and out, especially when this service is introduced by a module with the idea that dependant module can use it.
I wanted to abstract my WCF data services inside of application services and use ServiceLocator to resolve concrete instances from within my view-models, however im having a hard time working out how this should hang together, mainly due to my entites being part of the WCF service.
For example
Module1 Contains WCF Service + Concrete Application Service(ISearchService) + WCF Service generated entities(model)
Module1.Infastructure - Contains the following interface for the application service
public interface ISearchService
{
ObservableCollection<Person> Search(string search);
}
this would be registered in the UnityContainer so that any other module can get the concrete implementation introcuded by the module.
My problem is that the Entities (Person) are defined in the module itself (in the WCF service), so introducing a service and then expecting any other modules to be able to use it means they need to reference the module itself not just the modules infastructure, unless i pull out the services into another assembly.
Should i be exposing my entites that are auto generated from my EF model in this way?
Does anyone have a better solution ?
Modelobjects, or a data transfer object. I ended up going with a DTO, and found it much easier to have it return a data transfer object and use something like AutoMapper to mapDTOstoModelsand vice versa - Rachel