data icon indicating copy to clipboard operation
data copied to clipboard

DbDataAdapter for typed poco

Open VitaliyMF opened this issue 7 years ago • 1 comments

It is possible to add DbDataAdapter<T> 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);    
}
  • async methods

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

VitaliyMF avatar Sep 02 '16 08:09 VitaliyMF

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.

VitaliyMF avatar Mar 30 '17 16:03 VitaliyMF