提交更新

This commit is contained in:
CortexCore
2023-07-12 15:27:27 +08:00
parent 4af7cec47b
commit 498b0617f8
13 changed files with 294 additions and 154 deletions

View File

@@ -130,6 +130,7 @@ public class IDIS_DBContext:DbContext
//var sql = SQLiteContextHelper.GetConnectionString("IDIS");
SQLiteContextHelper.GetConnectionSqlAndPath("IDIS",out var sql,out var path);
optionsBuilder.UseSqlite(sql);
optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.TrackAll);
BIT4Log.Log<IDIS_DBContext>($"已创建标识数据库:{path}");
}
@@ -141,8 +142,9 @@ public class IDIS_DBContext:DbContext
/// <returns>是否查询到了内容</returns>
public bool Query(string key, out IDIS_Query[] queries)
{
ChangeTracker.DetectChanges();
ChangeTracker.Clear();
queries = Values
.ToList()
.Where(x => x.Handle.Contains(key))
.Select(x => new IDIS_Query()
{
@@ -233,6 +235,13 @@ public partial class IDIS_Service:Node
BIT4Log.Log<IDIS_Service>("已创建标识数据库");
UniTask.Run(()=>Context.Database.EnsureCreatedAsync());
}
public override void _ExitTree()
{
Context.Dispose();
Context = null;
}
public bool Query(string word,out IDIS_Query[] queries) => Context.Query(word, out queries);
public bool Register(string handle) => Context.Register(handle);
public void Register(string handle, string format, string value,string category) => Context.Register(handle, format, value,category);