Skip to main content

Posts

Showing posts with the label why we use repository pattern in mvc 5

Repository Pattern in MVC 5

Repository pattern reduce the controller code complexity. We write the most of all business  logic in Repository with the help of entity frameworks classes. Repository work like a mediator that means its work between business logic  and data access layers. Steps of Implementing repository pattern in MVC 5 namespace PCX.Core.Repositories {      /// <typeparam name="C"></typeparam>     /// <typeparam name="T"></typeparam>     public abstract class GenericRepository <C, T> : IGenericRepository <T> where T : class   where C : DbContext , new ()     {         private C _entities = new C();         public C Context         {             get { return _entities; }   ...