This project has moved. For the latest updates, please go here.


Nov 10, 2009 at 12:38 PM


Is it possible to export LinqToSql and LinqToEntities datacontexts/models from a separate DAL project and be able to create LinqToSql and LinqToEntities DomainServices in a RIA solution?

I'm trying to create a modularized architecture in which I can make an MEF enabled DAL module which I can just drop in a directory from which MEF will pick it up using DirectoryCatalog. In the specific project I'm working right now I'm combining .NET RIA Services and MEF. If you are familiar with .NET RIA Services you know that the data is exposed to the client through a "DomainService" class which can be created from different datasources. In this case I'm looking at LinqToSql and LinqToEntities datasources. Where I'm stuck is trying to separate the LinqToSql and LinqToEntities data models into a separate project from which I can export them.  In the code below the LinqToSql and LinqToEntities models are in the same project as the DomainServices so the DomainServices know about them.


public class NorthwindService : LinqToEntitiesDomainService<NorthwindEntities> 


public class NorthwindService : LinqToSqlDomainService<NorthwindDataContext> 

If the data models and the DomainServices are separated into different projects they don't know about each other at design time. How can I create a DomainService class in one project by importing a LinqToSql and LinqToEntities export from another? Or is it even possible ATT?