创建与注册更新

现在可以注册模板并注册标识了
This commit is contained in:
CortexCore
2023-07-08 15:32:06 +08:00
parent 6fc4279878
commit 36a4309730
8 changed files with 205 additions and 76 deletions

View File

@@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net.Mime;
using BITKit;
using Cysharp.Threading.Tasks;
using Godot;
using Microsoft.EntityFrameworkCore;
@@ -194,6 +195,16 @@ public class IDIS_DBContext:DbContext
Datas.Add(data);
SaveChanges();
}
public void RegisterReference(string handle, string refenceHandle)
{
References.Add(new IDIS_Reference()
{
Handle = handle,
RelatedHandle = refenceHandle,
});
SaveChanges();
}
}
// ReSharper disable once IdentifierTypo
/// <summary>
@@ -206,9 +217,11 @@ public partial class IDIS_Service:Node
{
Context = new IDIS_DBContext();
BIT4Log.Log<IDIS_Service>("已创建标识数据库");
Context.Database.EnsureCreated();
UniTask.Run(()=>Context.Database.EnsureCreatedAsync());
}
public bool Register(string handle) => Context.Register(handle);
public void Register(string handle, string format, string value) => Context.Register(handle, format, value);
public void RegisterReference(string handle,string refenceHandle) => Context.RegisterReference(handle,refenceHandle);
public static string GenerateHandle() => $"88.123.99/{Mathf.Abs(Guid.NewGuid().GetHashCode())}";
}