lundi 2 mars 2015

Applying Repository Pattern to ReportViewModels


public interface IRepository<TEntity>
{
TEntity FindById(Guid id);
void Add(TEntity entity);
void Remove(TEntity entity);
}


This is a simple generic repository. If I have a Product entity, this repository can insert, update, delete. (Using entity framework.)


But I have Report based types that I created. For example:



  • Products that grouped by salesmen.


  • Number of orders sent by each shipper.


    public class OrdersWithShipper{ public string ShipperName{get;set;} public string NumberOfOrder{get;set;} }




And so on.


So I should create cpmplex queries to many tabres that related. But quey result object is not representing with repository TEntity entity type.


I have many report type like this. How can I solve this problem?


Aucun commentaire:

Enregistrer un commentaire