Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Data.Linq;
- public interface IObjectRepository<T>
- where T: class,new()
- {
- IList<T> GetList(int Skip, int Take,string sortExpression);
- void Insert(T value);
- }
- public abstract class ObjectRepository<T> : IObjectRepository<T>
- where T: class,new()
- {
- TBEntities _db = new TBEntities ();
- public IList<T> GetList(int skip, int take, string sortExpression)
- {
- var _query = from p in _db.GetTable<T>
- orderby sortExpression
- select p;
- if (skip> 0 && take> 0)
- return _query.Skip(skip).Take(take).ToList();
- else
- return _query.ToList();
- }
- }
Add Comment
Please, Sign In to add comment