Quellcode durchsuchen

链接字符串

Lishi
xxe vor 2 Jahren
Ursprung
Commit
8427804581
1 geänderte Dateien mit 7 neuen und 5 gelöschten Zeilen
  1. +7
    -5
      HKLib/DB/DbContext.cs

+ 7
- 5
HKLib/DB/DbContext.cs Datei anzeigen

@@ -15,7 +15,7 @@ namespace HKLib.DB
{
public static SqlSugarScope Context = new SqlSugarScope(new ConnectionConfig()
{
ConnectionString = Route(),
ConnectionString = Route,
DbType = DbType.Sqlite,//数据库类型
IsAutoCloseConnection = true //不设成true要手动close
}, db =>
@@ -26,11 +26,13 @@ namespace HKLib.DB
};
});

static string Route()
public static string Route
{
var dir = SyncStatic.CreateDir(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Database"));
var r= SyncStatic.CreateFile(Path.Combine(dir, "data.db3"));
return r;
get
{
var dir = SyncStatic.CreateDir(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Database"));
return $"DataSource={SyncStatic.CreateFile(Path.Combine(dir, "Data.db3"))}";
}
}
public static void InitTable()
{


Laden…
Abbrechen
Speichern