Reputation: 32179
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
...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.
Upvotes: 3
Views: 738
Reputation: 8339
This is one of the goals of Salamanca. It is still in early stages though, but we could use a coding hand or two...
If you want an existing solution, I suggest you delve into ORMs (as other suggested) possibly associated with code generation tools :
Check out this very complete ORMs list.
Upvotes: 2
Reputation: 5405
LINQ to Entities and the Entities framework for .Net are the two best cross-server solutions.
More information here: http://msdn.microsoft.com/en-us/library/bb386964.aspx
Upvotes: 1
Reputation: 4758
I know you said that you know about ORM's and don't want them, but could you deal with something where the data access methods you write are written in LINQ
?
I've found that I like writing LINQ
statements over SQL
statements. If you're open to this, I would check out Entity Framework, LINQ to SQL, NHibernate, etc.
Edit: If you want to use Azure, check out this link: http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/74a0a57e-d979-48ed-b534-f449bac0f90d
Upvotes: 2
Reputation: 10681
Use LINQ, that would practically do all the Data Access task for you...
Upvotes: 0
Reputation: 415881
Take a look at NHibernate, Castle ActiveRecord, SubSonic, LinqToSql, ...
You say you know about ORMs, but they do pretty much exactly what your question asks for, at least to the extent possible.
Upvotes: 3