Giter Club home page Giter Club logo

geeksarray / implement-repository-pattern-with-aspnet-core-web-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 4.0 6.21 MB

This blog explains how to implement a Repository Pattern with ASP.NET Web API, AutoMapper, Entity Framework, CRUD operations, and async operations.

Home Page: https://geeksarray.com/blog/implement-repository-pattern-with-aspnet-core-web-api

C# 76.00% TSQL 24.00%
aspnet-web-api aspnetcorewebapi aspnetmvccore automapper crud-operation crud-sample efcore entity-framework-core repository-pattern

implement-repository-pattern-with-aspnet-core-web-api's Introduction

Implement Repository Pattern with ASP.NET Core Web API

This blog explains how to implement a Repository Pattern with ASP.NET Web API, AutoMapper, Entity Framework, CRUD operations, and async operations.

Repository Pattern

A repository pattern is an abstraction that isolates business logic from the database access layer resulting in a decoupled architecture. Repositories hide logic that involves communication with the data store. Repository Pattern provides low-level abstraction.

You would usually have one repository per entity, for example, to perform CRUD operations on a Category entity you will have CategoryRepository.

Advantages of Repository Pattern

  1. Dependency Injection: you can inject interface dependency and mock repository, this increases the testability of your code. Directly using DBContext of EF Core in API Controller is not testable. For more details on Dependency Injection

  2. Decouples Persistence Framework Using Repository Pattern, it is easy to change the persistence framework for example from EF Core to Dapper or something else. So DataAccess Layer and Business Layer can be tested separately.

For More details visit - https://geeksarray.com/blog/implement-repository-pattern-with-aspnet-core-web-api

Test CRUD operations created using Repository Pattern

Implement Repository Pattern With ASP.NET Web API

implement-repository-pattern-with-aspnet-core-web-api's People

Contributors

geeksarray avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.