I am working on a WCF project, which provides business information out of several data sources. To reuse the code, my BusinessContactService contains a generic repository dependency defined as:
public interface IRepository<T> {
IQueryable<T> Find(Expression<Func<T, bool>> criteria);
}
And service queries data source via repository as:
repo.Find(b => b.Name.Contains("abc"));
When the data source is a sql server database, it works via Entity Framework. But when the service runs on an Ingres database, it comes a problem because its .NET data provider or ODBC driver doesn't work with LINQ expression. The following are some workarounds I've found:
- Virtuoso data provider for EF: As it isn't free and system team don't feel like install it anyway, I can't use it.
- Customize an Ingres EF provider as Entity Framework sample provider shows. It is quite interesting, but I am afraid not make the timeline (by next week!)
- Hiding the usage of LINQ expression in my service by using specification pattern. Therefore still use LINQ in sql server specifications implementation, while use ado.net for Ingres case.
- NHibernate.Linq. I know little on NHibernate, but someone here said it works fine with ODBC and I guess it may be able to bridge LINQ expression with Ingres.
Please give suggestions on option 2 - 4. Many Thanks!