Step 4. Create a new class library project called the Core project based on the ASP.NET Core framework. Right-click on solution item -> Add -> New project.
Step 5. Select “Class Library(.NET Core)”, then click “Add” button. The core project name sets “Enterprise_Dot_Net_Core_WebApp.Core.”
Step 6. Create the Interface folder under the core project. Change the default class file name from “class1.cs” to “Enterprise_MVC_Core.cs.”
Edit the Enterprise_MVC_Core.cs file, then adding some codes in the Enterprise_MVC_Core.cs file.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
namespace Enterprise_Dot_Net_Core_WebApp.Core.Entities
{
[Table("Enterprise_MVC_Core")]
public class Enterprise_MVC_Core
{
[Key]
public int ID { get; set; }
public string Name { get; set; } public int? Age { get; set; } }
} Step 7. Create the Entities folder, then move the Enterprise_MVC_Core file to the Entities folder. Create the new class file, whose name is “IEnterprise_MVC_CoreRepository.”
Step 8. Add interface source code in the IEnterprise_MVC_CoreRepository file.
using System;
using System.Collections.Generic;
using System.Text;
using Enterprise_Dot_Net_Core_WebApp.Core.Entities;
namespace Enterprise_Dot_Net_Core_WebApp.Core.Interface
{
public interface IEnterprise_MVC_CoreRepository
{
void Add(Enterprise_MVC_Core o);
void Edit(Enterprise_MVC_Core o);
void Remove(int ID);
IEnumerable GetData();
Enterprise_MVC_Core FindById(int ID);
}
} The single-responsibility principle (SRP) is a computer-programming principle that states that every module, class or…
Command query responsibility segregation (CQRS) generalizes CQS to message-driven and event-driven architectures: it applies the CQS…
Domain-driven design (DDD) is a software design approach focusing on modelling software to match a…
A microservice architecture – a variant of the service-oriented architecture (SOA) structural style – arranges…
The Repository pattern and Unit of Work pattern are used together in most time. Unit…
Visitor – It allows the program changes the algorithm and the operations that base on the visitor…
View Comments