4 support db
ansonzhang edited this page 2019-12-16 13:21:36 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

提醒

目前的单数据库使用哪个就把哪个Db 的 Enabled 设置为 true其他的设置为 false。

Sqlite

appsettings.json 中配置:

  "Sqlite": {
    "Enabled": true,
    "SqliteConnection": "WMBlog.db"//只写数据库名就行,我会拼接字符串
  },


SqlServer已测试版本2008 R2 及以上)

appsettings.json 中配置:

 "SqlServer": {
   "Enabled": true,
   "SqlServerConnection": "Server=.;Database=WMBlogDB;User ID=sa;Password=123;",
   "ProviderName": "System.Data.SqlClient"
 },


LocalDB已测试版本MSSQL

appsettings.json 中配置:

 "SqlServer": {
   "Enabled": true,
   "SqlServerConnection": "Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=wm;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   "ProviderName": "System.Data.SqlClient"
 },


MySql已测试版本8.0.18 及以上)

appsettings.json 中配置:

  "MySql": {
    "Enabled": true,
    "MySqlConnection": "Server=localhost; Port=3306;Stmt=; Database=wmblogdb; Uid=root; Pwd=456;"
  },