nreco / data

Fast DB-independent DAL for .NET Core: abstract queries, SQL commands builder, schema-less data access, POCO mapping (micro-ORM).
https://www.nrecosite.com/dalc_net.aspx
MIT License
184 stars 39 forks source link

DbDataAdapter for typed poco #13

Open VitaliyMF opened 8 years ago

VitaliyMF commented 8 years ago

It is possible to add DbDataAdapter for typed CRUD operations with POCO with methods:

class DbDataAdapter<T> {
 T LoadByKey(params object[] key);
 List<T> Load(QConditionNode condition);  // maybe this method should be protected ?..
 void Insert(T model);
 void Update(T model);
 void Delete(T model);
 void DeleteByKey(params object[] key);    
}

This implementation may effectively reuse DbCommand instances and perform POCO-mapping very fast by caching getters/setters.

VitaliyMF commented 7 years ago

Not sure about class name, maybe Repository<T> is better?..

Also I think it is good idea to add List<T> Load(Expression<Func<T,bool>> predicate) for simple filtering by model properties.