I'm fundamentally sick of writing data access layers. I see it as a boring and pointless endeavour. I envisage a development environment where I can just create my Entities/Models and start building the application. The time taken to write the DAL, procedures, etc... just eats my enthusiasm for a project.
What I want is a generic repository interface for my data. Something like:
public interface IRepository
{
//Get individual TEntity item by id
TEntity GetItem<TIdentifier, TEntity>(TIdentifier id);
//Get individual TEntity item by the expression
TEntity GetItem<TIdentifier, TEntity, TArg>(Expression<Func<TArg, TEntity>> expression);
//Get individual TEntity item by the expression
TEntity GetItem<TIdentifier, TEntity, TArg1, TArg2>(Expression<Func<TArg1, TArg2, TEntity>> expression);
//Get all TEntity items
IList<TEntity> GetList<TEntity>();
//Get all TEntity items, filtered by the expression
IList<TEntity> GetList<TEntity, TArg>(Expression<Func<TArg, IList<TEntity>>> expression);
//Get all TEntity items, filtered by the expression
IList<TEntity> GetList<TEntity, TArg1, TArg2>(Expression<Func<TArg1, TArg2, IList<TEntity>>> expression);
TIdentifier CreateItem...
bool UpdateItem...
bool DeleteItem...
}
I'm specifically interested in something that would work for
- Azure Data Services
- SQL Server
- sqLite
...but the theory would apply to any data repository
Has anyone come across a ready built solution or do I have to fix the problem by writing more data access layers than I ever wanted to shake a stick at.
Note: I know about ORM's, I want something that removes the requirement to write any of the DAL or stored procs.