Compare commits
11 Commits
f7476a9d99
...
ac6640307a
Author | SHA1 | Date |
---|---|---|
|
ac6640307a | 2 weeks ago |
|
4102742597 | 2 weeks ago |
|
d38f5e97f9 | 3 weeks ago |
|
e142d1b9ad | 3 weeks ago |
|
237c3f2622 | 3 weeks ago |
|
5fd2e58424 | 3 weeks ago |
|
15bb9959db | 3 weeks ago |
|
f1f7e07c85 | 3 weeks ago |
|
21d0bd3051 | 3 weeks ago |
|
bb825881ac | 4 weeks ago |
|
fa88c59fd1 | 4 weeks ago |
31 changed files with 1109 additions and 519 deletions
@ -0,0 +1,82 @@
@@ -0,0 +1,82 @@
|
||||
# IEGSave 接口说明 |
||||
|
||||
--- |
||||
|
||||
只读&非只读数据说明: |
||||
|
||||
只读数据不实现写数据功能,非只读需要实现写数据功能。 |
||||
|
||||
正常数据通过Path加载,只读数据则是通过string加载,无法对其中Path进行写入操作。 |
||||
|
||||
| 接口名称 | 接口简介 | |
||||
| --------------------- | ------------ | |
||||
| IEGSave | 读写数据加载 | |
||||
| IEGSaveReadOnly | 只读数据加载 | |
||||
| IEGSaveObjectReadOnly | 只读对象 | |
||||
| IEGSaveObject | 读写对象 | |
||||
| IEGSaveDataReadOnly | 只读数据 | |
||||
| IEGSaveData | 读写数据 | |
||||
|
||||
## IEGSave |
||||
|
||||
### 描述 |
||||
|
||||
通用的存储数据加载接口,通过Path加载文件的数据。 |
||||
|
||||
### 方法说明 |
||||
|
||||
### void InitSaveFile(string path) |
||||
|
||||
> 通过文件路径加载存储文件 |
||||
|
||||
## IEGSaveReadOnly |
||||
|
||||
只读文件的数据加载接口,通过字符串或者字节流加载成对应的数据对象。 |
||||
|
||||
### void InitReadOnly(string data); |
||||
|
||||
> 通过字符串加载文件内容,需要先从文本文件中读取,请求服务或者其他方式获取内容。 |
||||
|
||||
### void InitReadOnly(byte[] data); |
||||
|
||||
> 通过字节流加载文件内容,需要先从字节流文件中读取,请求服务或者其他方式获取内容。 |
||||
|
||||
## IEGSaveObjectReadOnly |
||||
|
||||
只读对象文件的获取数据接口 |
||||
|
||||
### T GetObject<T>(string objectKey) where T: new(); |
||||
|
||||
> 通过键获取对应的对象,如果是单个对象文件的话,则传空字符串即可。 |
||||
|
||||
## IEGSaveObject : IEGSaveObjectReadOnly |
||||
|
||||
对象文件的获取&写入数据接口 |
||||
|
||||
### void SetObject<T>(string objectKey,T obj); |
||||
|
||||
> 将key值与key对应的对象写入到该文件下。 |
||||
|
||||
## IEGSaveDataReadOnly |
||||
|
||||
只读数据文件的获取数据接口 |
||||
|
||||
### T GetData<T>(string dataKey,object id) where T : new(); |
||||
|
||||
> 用于获取指定条目的数据对象。 |
||||
|
||||
### IEnumerable<T> GetAll<T>(string dataKey) where T : new(); |
||||
|
||||
> 用于获取key值下的所有列表数据 |
||||
|
||||
### IEnumerable<T> FindData<T>(string dataKey,Expression<Func<T, bool>> expression) where T : new(); |
||||
|
||||
> 用于查找key值下的所有满足条件的列表数据 |
||||
|
||||
## IEGSaveData |
||||
|
||||
数据文件的获取&写入数据接口 |
||||
|
||||
### void SetData<TData>(string dataKey,TData data,object id); |
||||
|
||||
> 将key值与key对应的对象的写入到该文件对应的位置(id)下,如果存在数据则进行覆盖。 |
@ -0,0 +1,130 @@
@@ -0,0 +1,130 @@
|
||||
# GenerateTools使用手册 |
||||
|
||||
> GenerateTools旨在生成任何应用程序中的组件,变量,对象,以及用到的一些流程等等。同时依赖于Save Tools强大的本地文件加载能力,Generate Tools可以通过配置各种文件实现界面的简单生成,菜单的生成,可编辑表格,可编辑项。 |
||||
> |
||||
> 再此之上,有些通用模板也会放在此工具下,方便扩展与生成。 |
||||
|
||||
```mermaid |
||||
mindmap |
||||
root((Generate-Tools)) |
||||
Code |
||||
SVG |
||||
Dialog |
||||
Basic |
||||
Confirm |
||||
Edit |
||||
File |
||||
UI |
||||
EditParam |
||||
Table |
||||
Menu |
||||
Tree |
||||
Inteface |
||||
Variant |
||||
Tree |
||||
Range |
||||
Select |
||||
Path |
||||
ReadOnly |
||||
``` |
||||
|
||||
## 📈生成一个可编辑表格 |
||||
|
||||
定义数据类,以学生信息为例 |
||||
|
||||
```csharp |
||||
public struct DataStudent |
||||
{ |
||||
public int ID; |
||||
public string Name { get; set; } |
||||
public int Age; |
||||
public EGPathSelect Path { set; get; } |
||||
public DataStudent(string name, int age) |
||||
{ |
||||
Name = name; |
||||
Age = age; |
||||
ID = 0; |
||||
Path = new EGPathSelect(); |
||||
} |
||||
} |
||||
``` |
||||
|
||||
实例化一组学生信息对象列表,然后通过EGodotTable来对该列表进行初始化 |
||||
|
||||
```csharp |
||||
public void TestTable() |
||||
{ |
||||
container = this.GetNode<TabContainer>("TabContainer"); |
||||
List<DataStudent> dataStudents = new List<DataStudent>(); |
||||
for (int stu = 0; stu < 10; stu++) |
||||
{ |
||||
dataStudents.Add(new DataStudent("stu" + stu, 18)); |
||||
} |
||||
for (int stu = 0; stu < 11; stu++) |
||||
{ |
||||
dataStudents.Add(new DataStudent("A" + stu, 20 + stu)); |
||||
} |
||||
EGodotTable table = container.CreateNode<EGodotTable>("Default"); |
||||
table.InitData<DataStudent>(dataStudents); |
||||
} |
||||
``` |
||||
|
||||
运行结果如下 |
||||
|
||||
 |
||||
|
||||
 |
||||
|
||||
## 🌲生成一个树 |
||||
|
||||
定义一个Json,使用EGodotTree来对该Json进行初始化 |
||||
|
||||
```csharp |
||||
public void TestTree() |
||||
{ |
||||
string json = @"{ |
||||
'CPU': 'Intel', |
||||
'PSU': '500W', |
||||
'My' : { |
||||
'AA':'BB', |
||||
'Date': 111 |
||||
} |
||||
}"; |
||||
container = this.GetNode<TabContainer>("TabContainer"); |
||||
EGodotTree eGodotTree = container.CreateNode<EGodotTree>("TestTree"); |
||||
eGodotTree.InitByJson(json); |
||||
} |
||||
``` |
||||
|
||||
 |
||||
|
||||
## 🚪生成一个可编辑弹窗并弹出 |
||||
|
||||
使用上述定义过的DataStudent,我们创建一个可编辑弹窗,并且在弹窗编辑完成后打印编辑后的内容。由于Godot子节点先加载,父节点后加载的机制,需要等待父节点实例化之后才能调用弹窗功能,我们使用一个延时方法(参考NodeExtension-EGThread部分),延时弹出该弹窗。 |
||||
|
||||
```csharp |
||||
public void TestDialog() |
||||
{ |
||||
DataStudent dataStudent = new DataStudent(); |
||||
dataStudent.EGenerateDictiontaryByObject(); |
||||
this.ExecuteAfterSecond(() => |
||||
{ |
||||
this.EGEditDialog(new DataStudent().EGenerateDictiontaryByObject(), e => |
||||
{ |
||||
GD.Print("Name:" + e["Name"] + "Age:" + e["Age"]); |
||||
}, "Edit"); |
||||
},0.2f); |
||||
} |
||||
``` |
||||
|
||||
调用该方法后会弹出空白弹窗 |
||||
|
||||
 |
||||
|
||||
输入内容 |
||||
|
||||
 |
||||
|
||||
点击确认,控制台输出姓名与年龄的信息,此时您可以使用SaveTools写入本地配置文件,或者是数据库,再或者向后台,上位机或下位机发送该信息。 |
||||
|
||||
 |
After Width: | Height: | Size: 53 KiB |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="CompressedTexture2D" |
||||
uid="uid://b2tuqm72haaab" |
||||
path="res://.godot/imported/GenerateTools_001.JPG-fef7115ccd57135de62d4bd2954db1db.ctex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://Manual/Img/GenerateTools_001.JPG" |
||||
dest_files=["res://.godot/imported/GenerateTools_001.JPG-fef7115ccd57135de62d4bd2954db1db.ctex"] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/high_quality=false |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_compression=1 |
||||
compress/normal_map=0 |
||||
compress/channel_pack=0 |
||||
mipmaps/generate=false |
||||
mipmaps/limit=-1 |
||||
roughness/mode=0 |
||||
roughness/src_normal="" |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/normal_map_invert_y=false |
||||
process/hdr_as_srgb=false |
||||
process/hdr_clamp_exposure=false |
||||
process/size_limit=0 |
||||
detect_3d/compress_to=1 |
After Width: | Height: | Size: 62 KiB |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="CompressedTexture2D" |
||||
uid="uid://c4fu1phlhotka" |
||||
path="res://.godot/imported/GenerateTools_002.JPG-7bb9bdf7b55c6f9bc9f2bca6dee8a982.ctex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://Manual/Img/GenerateTools_002.JPG" |
||||
dest_files=["res://.godot/imported/GenerateTools_002.JPG-7bb9bdf7b55c6f9bc9f2bca6dee8a982.ctex"] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/high_quality=false |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_compression=1 |
||||
compress/normal_map=0 |
||||
compress/channel_pack=0 |
||||
mipmaps/generate=false |
||||
mipmaps/limit=-1 |
||||
roughness/mode=0 |
||||
roughness/src_normal="" |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/normal_map_invert_y=false |
||||
process/hdr_as_srgb=false |
||||
process/hdr_clamp_exposure=false |
||||
process/size_limit=0 |
||||
detect_3d/compress_to=1 |
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="CompressedTexture2D" |
||||
uid="uid://crtdss0o45blw" |
||||
path="res://.godot/imported/GenerateTools_003.JPG-f588ba68b13367797de19c266c495b79.ctex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://Manual/Img/GenerateTools_003.JPG" |
||||
dest_files=["res://.godot/imported/GenerateTools_003.JPG-f588ba68b13367797de19c266c495b79.ctex"] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/high_quality=false |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_compression=1 |
||||
compress/normal_map=0 |
||||
compress/channel_pack=0 |
||||
mipmaps/generate=false |
||||
mipmaps/limit=-1 |
||||
roughness/mode=0 |
||||
roughness/src_normal="" |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/normal_map_invert_y=false |
||||
process/hdr_as_srgb=false |
||||
process/hdr_clamp_exposure=false |
||||
process/size_limit=0 |
||||
detect_3d/compress_to=1 |
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="CompressedTexture2D" |
||||
uid="uid://1y1cdhnueqcp" |
||||
path="res://.godot/imported/GenerateTools_004.JPG-87913768d75b083efc5aece06f847991.ctex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://Manual/Img/GenerateTools_004.JPG" |
||||
dest_files=["res://.godot/imported/GenerateTools_004.JPG-87913768d75b083efc5aece06f847991.ctex"] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/high_quality=false |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_compression=1 |
||||
compress/normal_map=0 |
||||
compress/channel_pack=0 |
||||
mipmaps/generate=false |
||||
mipmaps/limit=-1 |
||||
roughness/mode=0 |
||||
roughness/src_normal="" |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/normal_map_invert_y=false |
||||
process/hdr_as_srgb=false |
||||
process/hdr_clamp_exposure=false |
||||
process/size_limit=0 |
||||
detect_3d/compress_to=1 |
After Width: | Height: | Size: 19 KiB |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="CompressedTexture2D" |
||||
uid="uid://bb7r4akyiehi8" |
||||
path="res://.godot/imported/GenerateTools_005.JPG-d203aa9f562e6d6e3ea80cdbaa8a92f9.ctex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://Manual/Img/GenerateTools_005.JPG" |
||||
dest_files=["res://.godot/imported/GenerateTools_005.JPG-d203aa9f562e6d6e3ea80cdbaa8a92f9.ctex"] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/high_quality=false |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_compression=1 |
||||
compress/normal_map=0 |
||||
compress/channel_pack=0 |
||||
mipmaps/generate=false |
||||
mipmaps/limit=-1 |
||||
roughness/mode=0 |
||||
roughness/src_normal="" |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/normal_map_invert_y=false |
||||
process/hdr_as_srgb=false |
||||
process/hdr_clamp_exposure=false |
||||
process/size_limit=0 |
||||
detect_3d/compress_to=1 |
After Width: | Height: | Size: 19 KiB |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="CompressedTexture2D" |
||||
uid="uid://gbr2uywo1eip" |
||||
path="res://.godot/imported/GenerateTools_006.JPG-e3f17b752a2788befdbb14fd67a4b7fe.ctex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://Manual/Img/GenerateTools_006.JPG" |
||||
dest_files=["res://.godot/imported/GenerateTools_006.JPG-e3f17b752a2788befdbb14fd67a4b7fe.ctex"] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/high_quality=false |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_compression=1 |
||||
compress/normal_map=0 |
||||
compress/channel_pack=0 |
||||
mipmaps/generate=false |
||||
mipmaps/limit=-1 |
||||
roughness/mode=0 |
||||
roughness/src_normal="" |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/normal_map_invert_y=false |
||||
process/hdr_as_srgb=false |
||||
process/hdr_clamp_exposure=false |
||||
process/size_limit=0 |
||||
detect_3d/compress_to=1 |
@ -0,0 +1,276 @@
@@ -0,0 +1,276 @@
|
||||
# SaveTools使用手册 |
||||
|
||||
--- |
||||
|
||||
注:SaveTools 目前因为接口反复修改的关系,Load方法增加对象的返回值以提供更多的操作方法。下面Not Complete表示该部分功能并未开发完毕。 |
||||
|
||||
```mermaid |
||||
mindmap |
||||
root((SaveTools)) |
||||
Data |
||||
CSV |
||||
LiteDB |
||||
Dapper |
||||
MySql |
||||
Sqlite |
||||
|
||||
File |
||||
FTP |
||||
SFTP |
||||
LocalFileSystem |
||||
WebDav - Not Complete |
||||
Object |
||||
Json |
||||
Redis |
||||
Byte - Not Complete |
||||
``` |
||||
|
||||
## 支持的数据类型 |
||||
|
||||
- `Object` 对象类型的存储类型,通过key-value的方式获取对应的对象,常见的例子有Json,Redis等等。 |
||||
- `Data` 数据类型的存储类型,同样通过key-Table的方式获取对应的数据表,通常为各种类型的数据库,比如MySql,Sqlite,LiteDB,CSV表格文件等等。 |
||||
- `File` 文件类型的存储类型,提供对应的下载,上传接口以及各类文件系统管理接口,通常为各种文件共享服务,比如FTP,WebDav,本地文件系统等等。 |
||||
|
||||
|
||||
|
||||
## 加载存储管理对象(可读可写) |
||||
|
||||
Load为可读写存储对象的加载,通常是用Path,或者数据库地址来进行实例化。 |
||||
|
||||
以SQLite数据库为例 |
||||
|
||||
```csharp |
||||
EGSqliteSave SqliteTest = this.EGSave().Load<EGSqliteSave>("SaveData/test.db"); |
||||
``` |
||||
|
||||
具体使用方法详见API - IEGSaveData部分。 |
||||
|
||||
## 读取存储管理对象(只读) |
||||
|
||||
Read为只读存储对象的加载,通常以字符&字节流的方式来获取,由于是只读数据,仅包含相关数据的搜索,获取功能。 |
||||
|
||||
以Json为例 |
||||
|
||||
```csharp |
||||
string json = @"{ |
||||
'CPU': 'Intel', |
||||
'PSU': '500W', |
||||
'Drives': [ |
||||
'DVD read/writer' |
||||
/*(broken)*/, |
||||
'500 gigabyte hard drive', |
||||
'200 gigabyte hard drive' |
||||
], |
||||
'My' : { |
||||
'AA':'BB', |
||||
'Date': new Date(123456789) |
||||
} |
||||
}"; |
||||
EGJsonSave jsonManage = this.EGSave().Read<EGJsonSave>("Example", json); |
||||
GD.Print(jsonManage.GetObject<string>("CPU")); |
||||
``` |
||||
|
||||
## 数据库增删改查 |
||||
|
||||
针对Data型的存储类型,可以简单实现数据库的增删改查,同时可使用Database的建表操作完成数据库的初始化。 |
||||
|
||||
首先我们定义两个结构类型,其一是符合类型,带相关对象的: |
||||
|
||||
```csharp |
||||
public struct DataStudent |
||||
{ |
||||
public int ID; |
||||
public string Name { get; set; } |
||||
public int Age; |
||||
public EGPathSelect Path { set; get; } |
||||
public DataStudent(string name, int age) |
||||
{ |
||||
Name = name; |
||||
Age = age; |
||||
ID = 0; |
||||
Path = new EGPathSelect(); |
||||
} |
||||
} |
||||
``` |
||||
|
||||
其二是只包含原始类型(IsPrimitive)和string类型的结构,其中类结构里面的所有属性(除了主键ID自增外)皆为属性类型。 |
||||
|
||||
```csharp |
||||
public struct DataStu |
||||
{ |
||||
public int ID; |
||||
public string Name { get; set; } |
||||
public int Age { set; get; } |
||||
public string Path { set; get; } |
||||
public DataStu(string name, int age,string path) |
||||
{ |
||||
Name = name; |
||||
Age = age; |
||||
ID = 0; |
||||
Path = path; |
||||
} |
||||
} |
||||
``` |
||||
|
||||
后面我们会讲到两种类型兼容方面的差异,第一种仅支持单项操作,复数操作无法很好的兼容,第二种则支持复数操作(适用于数据批量导入,备份功能的定制)。 |
||||
|
||||
以MySQL为例: |
||||
|
||||
### 数据库连接 |
||||
|
||||
```csharp |
||||
EGDapper mysqlSave = this.EGSave().Load<EGMysqlSave>("server=" + "localhost" + ";port=" + "3306" + ";uid=" + "root" + ";pwd=" + "root" + ";database=" + "Test3" + ";"); |
||||
``` |
||||
|
||||
或者 |
||||
|
||||
```csharp |
||||
EGMysqlSave mysqlSave = this.EGSave().Load<EGMysqlSave>("server=" + "localhost" + ";port=" + "3306" + ";uid=" + "root" + ";pwd=" + "root" + ";database=" + "Test3" + ";"); |
||||
``` |
||||
|
||||
### 查询表名是否存在 |
||||
|
||||
```csharp |
||||
bool isExist = mysqlSave.ContainsKey("DataStudent"); |
||||
GD.Print(isExist); |
||||
``` |
||||
|
||||
### 查询对应ID的条目是否存在 |
||||
|
||||
```csharp |
||||
bool isExist = mysqlSave.ContainsData("DataStudent",3); |
||||
GD.Print(isExist); |
||||
``` |
||||
|
||||
### 初始化表 |
||||
|
||||
如果包含复合对象的,比如其它类对象的声明(例如上面的 EGPathSelect),此选项创建的字段为varchar(255),同String。 |
||||
|
||||
```csharp |
||||
mysqlSave.CreateTable<DataStudent>("DataStudent"); |
||||
``` |
||||
|
||||
### 增加数据 |
||||
|
||||
关于Path属性,会根据该类的ToString()方法,插入到表格对应的Path字段中。 |
||||
|
||||
```csharp |
||||
DataStudent stuData = new DataStudent("Bob", 12); |
||||
stuData.Path = new EGPathSelect(){Path = "AA"}; |
||||
mysqlSave.AddData("DataStudent",stuData); |
||||
``` |
||||
|
||||
或者 |
||||
|
||||
```csharp |
||||
DataStu stu1 = new DataStu("Anti", 20,"London"); |
||||
mysqlSave.AddData("DataStudent",stu1); |
||||
``` |
||||
|
||||
### 批量增加数据 |
||||
|
||||
注意,批量增加数据时,需要保证对象结构必须包含表字段的所有非空属性(此框架提供的建表方法字段默认非空)。其中类结构里面的所有属性(除了主键ID自增外)皆为属性类型。 |
||||
|
||||
```csharp |
||||
DataStu stu2 = new DataStu("CC", 23,"NewYork"){Age = 19}; |
||||
DataStu stu3 = new DataStu("Rocket", 24,"Paris"){Age = 26}; |
||||
List<DataStu> stuList = new List<DataStu>(); |
||||
stuList.Add(stu2); |
||||
stuList.Add(stu3); |
||||
mysqlSave.AddData<DataStu>("DataStudent",stuList); |
||||
``` |
||||
|
||||
### 删除数据(通过ID) |
||||
|
||||
删除ID为2的一条数据(可配合FindData找到要删除的内容的ID,实现批量删除) |
||||
|
||||
```csharp |
||||
mysqlSave.RemoveData("DataStudent",2); |
||||
``` |
||||
|
||||
### 查找数据(通过表达式) |
||||
|
||||
查找Name为CC的数据 |
||||
|
||||
```csharp |
||||
IEnumerable<DataStu> findStudent = mysqlSave.FindData<DataStu>("DataStudent", e => e.Name == "CC"); |
||||
GD.Print(findStudent.Count() +" data has been find!"); |
||||
foreach (DataStu stu in findStudent) |
||||
{ |
||||
GD.Print(stu.Path); |
||||
} |
||||
``` |
||||
|
||||
### 查找数据(通过关键词) |
||||
|
||||
查找Name包含C的数据,注意:通过关键词查找的数据大小写不敏感,包含小写c也会被检索出来 |
||||
|
||||
```csharp |
||||
IEnumerable<DataStu> findStudent = mysqlSave.FindData<DataStu>("DataStudent","Name","C"); |
||||
GD.Print(findStudent.Count() +" data has been find!"); |
||||
foreach (DataStu stu in findStudent) |
||||
{ |
||||
GD.Print(stu.Path); |
||||
} |
||||
``` |
||||
|
||||
### 修改数据 |
||||
|
||||
查找所有Name字段包含CC的数据,并给名称增加编号。 |
||||
|
||||
```csharp |
||||
IEnumerable<DataStu> findStudent = mysqlSave.FindData<DataStu>("DataStudent","Name","CC"); |
||||
GD.Print(findStudent.Count() +" data has been find!"); |
||||
int count = 0; |
||||
foreach (DataStu stu in findStudent) |
||||
{ |
||||
DataStu NewData = new DataStu("CC_" + count, stu.Age, stu.Path); |
||||
mysqlSave.UpdateData("DataStudent", NewData, stu.ID); |
||||
count++; |
||||
} |
||||
``` |
||||
|
||||
|
||||
|
||||
## 开发计划(随版本更新) |
||||
|
||||
Object: |
||||
|
||||
- [x] Json |
||||
|
||||
- [x] Redis |
||||
|
||||
- [ ] Byte |
||||
|
||||
- [ ] etc... |
||||
|
||||
Data: |
||||
|
||||
- [x] LiteDB |
||||
- [x] Dapper |
||||
- [x] Sqlite |
||||
- [x] MySql |
||||
- [x] Csv |
||||
- [ ] etc... |
||||
|
||||
File: |
||||
|
||||
- [x] LocalFile |
||||
- [x] Ftp |
||||
- [x] SFtp |
||||
- [ ] WebDav |
||||
- [ ] etc... |
||||
|
||||
|
||||
|
||||
# 使用案例 |
||||
|
||||
## 配置文件写入与加载 |
||||
|
||||
|
||||
|
||||
## 简易背包 |
||||
|
||||
|
||||
|
||||
## 使用CQRS实现可追溯的文件操作 |
Loading…
Reference in new issue