|
|
@@ -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() |
|
|
|
{ |
|
|
|