SHARE
TWEET

Untitled

a guest Dec 4th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public interface IBaseRepository<TEntity> where TEntity : BaseEntity
  2.  
  3. public  class BaseRepository<TContext, TEntity> : IBaseRepository<TEntity> where TEntity : BaseEntity, new() where TContext : DbContext, new()
  4.  
  5.  
  6.  
  7. public interface IUnitOfWork : IDisposable
  8.     {
  9.         IBaseRepository<TEntity> GetRepository<TEntity>() where TEntity : BaseEntity;
  10.         int SaveChanges();
  11.  
  12.     }
  13.  
  14.  
  15.  
  16.  
  17. public class UnitOfWork : IUnitOfWork
  18.     {
  19.  public IBaseRepository<TEntity> GetRepository<TEntity>() where TEntity : BaseEntity
  20.         {
  21.  
  22.             return new BaseRepository<TEntity>(_context, Activator.CreateInstance(typeof(TEntity)));
  23.         }
  24.  
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top