添加了部分界面

This commit is contained in:
CortexCore
2023-07-08 00:02:32 +08:00
parent f4e85d4f9b
commit a2da9039f8
23 changed files with 768 additions and 48 deletions

View File

@@ -163,6 +163,37 @@ public class IDIS_DBContext:DbContext
return queries.Any();
}
public bool Register(string handle)
{
var handleExists = Values.Any(x => x.Handle == handle);
if (handleExists)
{
return false;
}
var value = new IDIS_Value()
{
Handle = handle
};
Values.Add(value);
SaveChanges();
return true;
}
public void Register(string handle,string format, string value)
{
var handleExists = Values.Any(x => x.Handle == handle);
if (!handleExists)
{
Register(handle);
}
var data = new IDIS_Data()
{
Handle = handle,
Format = format,
Value = value
};
Datas.Add(data);
SaveChanges();
}
}
// ReSharper disable once IdentifierTypo
/// <summary>
@@ -177,4 +208,7 @@ public partial class IDIS_Service:Node
BIT4Log.Log<IDIS_Service>("已创建标识数据库");
Context.Database.EnsureCreated();
}
public bool Register(string handle) => Context.Register(handle);
public void Register(string handle, string format, string value) => Context.Register(handle, format, value);
}