Repository Pattern with c# and Entity Framework

ImtiajAhammad 555 views 21 slides Apr 09, 2021
Slide 1
Slide 1 of 21
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21

About This Presentation

Repository pattern concept and implementation in asp.net MVC with C# and entity framework
source code: https://github.com/imtiajahammad/RepositoryPatternWithCSharpAndEntityFramework

#imtiajLearnings
#imtiajFables


Slide Content

Repository Pattern with C# and Entity Framework Concept & implementation Overview

What is Repository Pattern? Mediates between the domain and data mapping layers, acting like an in-memory collection of domain objects

Benefits Minimizes duplicate query logic

Benefits Decouples your application from persistence frameworks Promotes testability

Repository pattern in a nutshell Should act like a collection of memory Repository should not have save or update method Repository should not have semantics of your database Should only be a collection of objects and memory

Repository pattern in a nutshell Then how are we going to save these objects to the database ? Solution : Unit of Work Unit of Work : Maintains a list of objects affected by a business transaction and coordinates the writing out of changes

Repository pattern in a nutshell

Implementing the Repository Pattern

Implementing the Repository Pattern

Implementing the Repository Pattern: IRepository

Implementing the Repository Pattern: Repository

Implementing the Repository Pattern: Repository

Implementing the Repository Pattern: Repository

Implementing the Repository Pattern: ICourseRepository

Implementing the Repository Pattern: CourseRepository

Implementing the Repository Pattern: IAuthorRepository

Implementing the Repository Pattern: AuthorRepository

Implementing the Repository Pattern: IUnitOfWork

Implementing the Repository Pattern: UnitOfWork

Implementing the Repository Pattern: Example

Thank you for your time Reference: https:// www.youtube.com/watch?v=rtXpYpZdOzM&t=1374s&ab_channel=ProgrammingwithMosh Assembled by: Imtiaj Ahammad Find me: https://www.linkedin.com/in/imtiaj-ahammad-2175a3130 / Source Code: https:// github.com/imtiajahammad/RepositoryPatternWithCSharpAndEntityFramework