The last time I wrote a system architecture based on MVC pattern and command mode, I also made a simple example.
After writing what I want to write, I want to use a specific project to concatenate most of the design pattern ideas.
What I want to say today is the single piece mode.
First of all, a simple description of what is a single piece mode, also known as Singleton mode, to achieve a single instance of the function, not specifically said, do not understand the other introduction of conceptual articles.
Usually, in the project I have done, the most application singleton is to do the adapter, below I will explain how to do the adapter.
First, we introduce the application process of implementing a single instance of the adapter through a single piece mode.
Before I introduce the single piece mode, I want to introduce the concept of service-oriented programming first. In my current design thinking process, I think that any one of the business logic is based on service.
Services are coupled through interfaces and implementations. The following is an example of a system that I developed earlier to describe how to do an adapter by abstracting the core idea.
First, make a solution.
Do a user class service interface
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
namespace IService
{
public interface IUserService
{
Users Load();
void Insert(User user);
void Update(User user);
void Delete(User user);
}
}