Step 6. Create the core project that is the class library project. The core project should include two items, such as Domain entities and Repository interfaces. It should not have any external dependencies, for example, the reference of the ORM(LINQ to SQL or EF), the reference of ADO.NET libraries, and the reference of Entity Framework.
The core project name sets “Enterprise_MVC_WebApplication.Core.”
Step 7. Install the System.ComponentModel.DataAnnotations by Nuget package manager.
Step 8. Add the new class file which name is the Enterprise_MVC_Core files.
using System;
using System.ComponentModel.DataAnnotations;
namespace Enterprise_MVC_WebApplication.Core
{
public class Enterprise_MVC_Core
{
public int ID { get; set; } = 0;
[Required]
[MaxLength(50)]
public string Name { get; set; } = string.Empty;
public int Age { get; set; } = 0;
}
} Step 9. Create the Interface folder under the core project.
Step 10. Add the new class file, which name is “IEnterprise_MVC_CoreRepository.”
using System.Collections.Generic;
namespace Enterprise_MVC_WebApplication.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