In my ASP.NET MVC 3 application I am to use EF4.3 as an ORM framework for now. I want to have an ability to substitute it in future in case I need to. This calls for defining an interface, that will point to DbContext implementation in case of EF.
What do I define in my Interface for queryable object?
For example in my case I am going to do the following, but don't know if it's a correct way to go:
in my Interface:
IQueryable<AnonymousUser> AnonymousUsers { get; }
int SaveChanges();
in my DbContext:
public DbSet<AnonymousUser> AnonymousUsers { get; set; }
IQueryable<AnonymousUser> IThoughtCatStorage.AnonymousUsers
{
get { return AnonymousUsers; }
}
As you can see, using an IQueryable is one way to abstract the DbSets out.
Is this the best way? (I know this sounds rather discussion-like, but I just want to know if currently there is a more generalizing way to define an ORM-access interface. )