vengine初步实现增删改查

This commit is contained in:
2023-09-06 18:50:20 +08:00
parent b52e48ce9a
commit 64e1a60780
41 changed files with 2820 additions and 2752 deletions

View File

@@ -0,0 +1,45 @@
namespace Tnb.Core;
/// <summary>
/// 字典对象
/// </summary>
public class DObject : Dictionary<string, object>
{
public DObject() { }
public DObject(string key, object value)
{
Add(key, value);
}
public DObject(Dictionary<string, object> dictionary) : base(dictionary)
{
}
public void AddCascade(string code, object value)
{
var keys = code.Split('.');
if (keys.Length == 1)
{
Add(code, value);
return;
}
for (int i = 0; i < keys.Length; i++)
{
DObject temp = this;
if (i < keys.Length - 1)
{
if (!ContainsKey(keys[i]))
{
temp = new DObject();
Add(keys[i], temp);
}
else
{
temp = (DObject)temp[keys[i]];
}
}
else
{
temp.Add(keys[i], value);
}
}
}
}