I am basically a fan of writing data access layers. I see this as a boring and pointless job. I envision a development environment where I can simply create my objects / models and start building the application. The time it takes to write DALs, procedures, etc. Just absorbs my enthusiasm for the project.
What I want is a common repository interface for my data. Sort of:
public interface IRepository
{
TEntity GetItem<TIdentifier, TEntity>(TIdentifier id);
TEntity GetItem<TIdentifier, TEntity, TArg>(Expression<Func<TArg, TEntity>> expression);
TEntity GetItem<TIdentifier, TEntity, TArg1, TArg2>(Expression<Func<TArg1, TArg2, TEntity>> expression);
IList<TEntity> GetList<TEntity>();
IList<TEntity> GetList<TEntity, TArg>(Expression<Func<TArg, IList<TEntity>>> expression);
IList<TEntity> GetList<TEntity, TArg1, TArg2>(Expression<Func<TArg1, TArg2, IList<TEntity>>> expression);
TIdentifier CreateItem...
bool UpdateItem...
bool DeleteItem...
}
I am particularly interested in what will work for
- Azure Data Services
- SQL Server
- Sqlite
... but the theory applies to any data repository
Does anyone encounter a ready-made built-in solution or do I need to fix the problem by writing more data access layers than I ever wanted to shake a stick.
. ORM, -, DAL .