Skip to main content

Posts

Showing posts with the label .Net5

.NET5 MVC CRUD Operations Using Entity Framework Core

In this article, we will learn about .Net5 MVC CRUD operation using Entity Framework Core. MVC: The Model-View-Controller(MVC) is an architectural pattern. MVC divides UI applications into 3 different layers. Each layer will have its own responsibility. An MVC application on encountering the user request will be sent to the controller. The controller will query the required data from the database and then furnished our data into 'Model' and then select appropriate 'View'. The 'View' will render the data or logic inside of the 'Model'. The 'Model' is the bridge between 'Controller' and 'View' for transferring the data. So in  MVC, the 'Controller' depends on both 'Model' and 'View', the 'View' depends on 'Model'. Create A .Net5 MVC Application: Begin our journey by creating a .Net5 MVC application. Visual Studio users can easily create a .Net5 MVC templated application. On Creating applic

.NET5 Razor Pages CRUD Operations Using Entity Frame Work Core

In this article, we will implement a sample application .Net5 Razor Pages CRUD operations using entity framework core. Razor Pages: Razor Page is a simplified web application model. On comparing with 'MVC' template, razor pages won't have 'Controller', which means razor pages is a combination of 'Views' and 'Models'. Routing itself configured within the page or view. A razor page mostly contains 2 files like 'filename.cshtml'(view) and 'filename.cshtml.cs'(model). Create A .Net5 Razor Page Application: Begin our journey by creating a .Net5 razor page template application. Visual Studio users it is very easy to create razor applications by selecting the template option like 'ASP.NET Core Web APP'. Here I'm using a visual studio code editor and .Net CLI commands to generate the application. CLI Command To Create Razor Page Application: dotnet new webapp -n your_project_name After creating the project few basic things we

Clean Architecture In .Net5 Application

In this article, we will learn about Clean Architecture and then we will implement a .Net5 sample application. Clean Architecture: Clean Architecture core building blocks are: Application Core Infrastructure UI Application Clean Architecture lives on the dependency inversion principle. In general business, logic depends on the data access layer or infrastructure layer. But in clean architecture, it is inverted, which means data access layers or infrastructure layers depend on the business logic layer(which means Application Core). So with the dependency inversion technique it easy to configure 'Unit Test' or 'Integrating Test'. Application Core: Application Core is a top layer or parent layer which will not depend on any other layer. So other layers like Infrastructure or UI depend on the 'Application' core. Application Core contains 'Entites', 'DTOs', 'Interfaces', 'BusinessLogics', etc. So while creating projects if we want

A Demo On HotChocolate GraphQL Subscriptions(Pub/Sub) Using Application InMemory Storage

This article will implement a small demo on subscriptions in Hot Chocolate Graphql using the application In-Memory storage. Since our target storage is application In-Memory, so this approach only apt for a single server hosted application. For applications with multiple servers then we have to use Redis Store. GraphQL Subscription Flow: In general, events raising or publishing will be triggered from the GraphQL mutation resolvers. Inside mutation resolvers raise the event to store the data into application in-memory storage. In GraphQL 'Subscriptions' is one of the root definitions like 'Query', Mutation'. So the subscription resolvers will always receive the data from in-memory storage. So the subscription resolvers can also be called subscribers whose job always watches the data send by the raised events. So the event raised from the mutation resolver will be received by all subscribers. Create A .Net5 Web API App: Now let's begin our journey by creat