Guest User

Untitled

a guest
Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Data.Linq;
  6.  
  7. public interface IObjectRepository<T>
  8. where T: class,new()
  9. {
  10. IList<T> GetList(int Skip, int Take,string sortExpression);
  11. void Insert(T value);
  12. }
  13.  
  14. public abstract class ObjectRepository<T> : IObjectRepository<T>
  15. where T: class,new()
  16. {
  17. TBEntities _db = new TBEntities ();
  18.  
  19. public IList<T> GetList(int skip, int take, string sortExpression)
  20. {
  21.  
  22. var _query = from p in _db.GetTable<T>
  23. orderby sortExpression
  24. select p;
  25.  
  26. if (skip> 0 && take> 0)
  27. return _query.Skip(skip).Take(take).ToList();
  28. else
  29. return _query.ToList();
  30.  
  31. }
  32. }
Add Comment
Please, Sign In to add comment