浏览代码

链接字符串

Lishi
xxe 2 年前
父节点
当前提交
8427804581
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. +7
    -5
      HKLib/DB/DbContext.cs

+ 7
- 5
HKLib/DB/DbContext.cs 查看文件

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


正在加载...
取消
保存