First, there are two ways to introduce Sqlsugar to a project:
1) Use the NuGet guide package directly
2) GitHub download source code, then project reference
The second is chosen here.
After the introduction of success, we need to configure the environment according to their own habits, such as database connection string How to put, how convenient to use Sqlsugar for crud.
First look at the database connection string, I put it in the BaseDBConfig.cs,
(It is customary to put it in the system configuration file, the. NET core environment, the Web. config mechanism is removed, the configuration is used to store JSON files, about the use of JSON read-write configuration information after a chapter dedicated)
And then the most important BaseDB.cs:
The Basedb class now places only one function called Getclient (), which returns a Sqlsugarclient class, which is the key to crud.
This chapter is simple to configure to this, the next chapter to combat the actual use of the existing framework, quickly write a student class of additions and deletions to check.
"Build your own. NET Core API Framework from scratch" (iii) Integrated lightweight orm--sqlsugar:3.1 Build environment