Automatic data access level

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
{
    //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 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 .

+3
5

NHibernate, Castle ActiveRecord, SubSonic, LinqToSql,...

, ORM, , , , .

+3

, , ORM , , , , LINQ?

, LINQ SQL. , Entity Framework, LINQ to SQL, NHibernate ..

: Azure, : http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/74a0a57e-d979-48ed-b534-f449bac0f90d

+2

Salamanca. , ...

, ORM ( ), :

Browse this complete list of ORMs .

+2
source

LINQ to Entities and the Entities framework for .Net are the two best cross-server solutions.

Additional information here: http://msdn.microsoft.com/en-us/library/bb386964.aspx

+1
source

Use LINQ, which will almost complete the entire task of accessing data ...

0
source

Source: https://habr.com/ru/post/1715076/


All Articles