DNLiCore_DB 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package DNLiCore_DB --version 1.0.3                
NuGet\Install-Package DNLiCore_DB -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DNLiCore_DB" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DNLiCore_DB --version 1.0.3                
#r "nuget: DNLiCore_DB, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DNLiCore_DB as a Cake Addin
#addin nuget:?package=DNLiCore_DB&version=1.0.3

// Install DNLiCore_DB as a Cake Tool
#tool nuget:?package=DNLiCore_DB&version=1.0.3                

---介绍---
DNLiCore_DB 是属于DNLiCore框架下的一个数据库工具类,目标支持数据库类型包括 MySql,SqlServer,SqlLite,Access
其中包括3种执行框架 Ado.net:SqlHelper,轻量级ORM:Petapoco,标准EF框架:EF Core


----------------------------------------MySql Start----------------------------------------------------------
------ADO.NET:DNLiCore_DB_MySqlHelper 使用说明------
1.引用DNLiCore_DB项目
2.在appsettings.json配置mysql数据库的配置例如
 {
 "ConnectionStrings": {
   "SqlServerConnection": "Server=*****;Database=*****;User ID=****;Password=*****;",
   "MySqlConnection": "Database='*****';Data Source=******;User ID=****;Password=******.;CharSet=utf8;SslMode=None"
 }
}
3.在Startup.cs 进行服务注入
 例如:
 services.AddSingleton(typeof(DNLiCore_DB.IMySqlHelper),new DNLiCore_DB.MySqlHelper(Configuration.GetConnectionString("MySqlConnection")));
4.在控制器注入使用

------ORM:PetapocoHelper使用说明------
1.引用DNLiCore_DB项目
2.在appsettings.json配置mysql数据库的配置例如
 {
 "ConnectionStrings": {
   "SqlServerConnection": "Server=*****;Database=******;User ID=****;Password=*****;",
   "MySqlConnection": "Database='*****';Data Source=*****;User ID=*****;Password=*****.;CharSet=utf8;SslMode=None"
 }
}
3.在Startup.cs 进行服务注入
 例如:
 services.AddSingleton(typeof(DNLiCore_DB.IPetaPocoHelper),new DNLiCore_DB.PetaPocoHelper(Configuration.GetConnectionString("MySqlConnection"),0));
4.在控制器注入使用


------EFCore使用说明------
1.创建相应的DBContext和实体    
 1.1 通过程序包管理控制台生成DBContext和实体输入,按需引用DNLiCore_DB
     Scaffold-DbContext -Force  "Server=******;User Id=*****;Password=*****;Database=*****" -Provider "Pomelo.EntityFrameworkCore.MySql"     
  注意:1.表必须要有主键
       2.如果有需要只生成单表的加个 -Table 表名
    3.会存在datetime数据类型实体生成错误的情况,需要手动修改。     
 1.3 在Startup.cs 进行服务注入
     例如:
     services.AddSingleton(typeof(DNLiCore_DB.IRepository), new DNLiCore_DB.Repository(new DNLiCore_Model.drewtestContext()));
 1.4 在控制器注入使用

----------------------------------------MySql End----------------------------------------------------------



--------------------------

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.2 1,572 1/15/2019
1.1.1 1,464 1/7/2019
1.1.0 1,308 1/7/2019
1.0.9 1,509 12/27/2018
1.0.8 1,505 12/9/2018
1.0.7 1,693 12/9/2018
1.0.6 1,579 12/9/2018
1.0.5 1,512 12/7/2018
1.0.4 1,506 12/7/2018
1.0.3 1,432 12/7/2018
1.0.2 1,520 12/7/2018