ASP.NET MVC Patterns

1.Architektura


In march 2013 I had honour to make presentation about Repository and UnityOfWork Patterns in ASP.NET MVC on Koszalin.NET community.
I decided to prepare introduction presentation to one of very popular ASP.NET MVC architectural concepts, btw which also can be used for Umbraco CMS development purpose.

3.Arch_preview

At the very beginning I’ve described simple commonly used ASP.NET MVC web architecture for small web project which used Microsoft ORM - Entity Framework as Data Access.
Describe consequences of base web solution during project growth, with number of functionality can be changed or added, was nice introduction to why we should use Repository and Unity of Work pattern in project.

What is Repository Pattern.
Repository patterns is approach to programming that give use separate abstraction level between data access layer and business access layer, what is important that Repository Pattern is database independent solution. 

Repository is kind of wrapper to wrap all CRUD operations that could occurred for object, created in separate logic layer. Designing Repository interface is correctly give us in futer implementation easily maintainable code. What also important during creating Repository interface and class implementation when we decide to use generic Repository solution - it will save us code duplication for specific operations.

1.Architektura_prev

Unity of Work 
UoW pattern purpose is to mange state of objects defined in specific repository and sharing database context. This approach allow as to reduce numbers direct of calls to DB connected with CRUD operations.
During working with object on repository we can add new object, update existing one and at very end Save() method on our entity framework context. Entity framework resolve all dependencies and conflicts we should add proper handle of any error that could occur.

Summary
You can find a lot of description about benefits in internet of using this approach. Applying this two patterns give you more control over your application development, reduce code duplication, in the end allows you to create more flexible web applications.

2.Arch_preview

Repository pattern and Unity of Work give us many benefits during developing web solutions. But most important but only mentioned on presentation is how use of this approach to improve Unit Testing in ASP.NET MVC Applications.


I was very pleased to do this presentation for Koszalin.Net community. Hope in near future I can give them brief presentation connected with Umbraco and Umbraco developments.

Tweets
    Umbitious.com 2017 all rights reserved.