Skip to content

Commit 40eca08

Browse files
committed
[增加]1. 增加DBServer 注释
1 parent 39b355f commit 40eca08

8 files changed

Lines changed: 41 additions & 6 deletions

File tree

DataBaseServer/GameFrameX.DBServer/DbService/MongoDB/MongoDBExtensions.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace GameFrameX.DBServer.DbService.MongoDB;
44

5+
/// <summary>
6+
/// MongoDB扩展
7+
/// </summary>
58
public static class MongoDbExtensions
69
{
710
/// <summary>

DataBaseServer/GameFrameX.DBServer/DbService/MongoDB/MongoState.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace GameFrameX.DBServer.DbService.MongoDB
22
{
3+
/// <summary>
4+
///
5+
/// </summary>
36
public class MongoState
47
{
58
/// <summary>

DataBaseServer/GameFrameX.DBServer/GameDB.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static void Close()
7575
/// <typeparam name="TState">文档的类型</typeparam>
7676
/// <param name="filter">过滤器表达式</param>
7777
/// <returns>表示异步操作的任务。任务结果包含文档</returns>
78-
public static Task<TState?> FindAsync<TState>(Expression<Func<TState, bool>> filter) where TState : ICacheState, new()
78+
public static Task<TState> FindAsync<TState>(Expression<Func<TState, bool>> filter) where TState : ICacheState, new()
7979
{
8080
return _dbServiceImpler.FindAsync<TState>(filter);
8181
}

DataBaseServer/GameFrameX.DBServer/IGameDbService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public interface IGameDbService
3535
/// <param name="filter">查询条件</param>
3636
/// <typeparam name="TState"></typeparam>
3737
/// <returns></returns>
38-
public Task<TState?> FindAsync<TState>(Expression<Func<TState, bool>> filter) where TState : ICacheState, new();
38+
public Task<TState> FindAsync<TState>(Expression<Func<TState, bool>> filter) where TState : ICacheState, new();
3939

4040
/// <summary>
4141
/// 查询数据

DataBaseServer/GameFrameX.DBServer/State/CacheState.cs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44

55
namespace GameFrameX.DBServer.State
66
{
7+
/// <summary>
8+
/// 缓存数据对象
9+
/// </summary>
710
[BsonIgnoreExtraElements(true, Inherited = true)]
811
[ProtoContract]
912
public class CacheState : ICacheState
1013
{
11-
public CacheState()
12-
{
13-
}
14-
1514
/// <summary>
1615
/// 唯一ID。给DB用的
1716
/// </summary>
@@ -24,9 +23,16 @@ public CacheState()
2423
[ProtoMember(888)]
2524
public long Id { get; set; }
2625

26+
/// <summary>
27+
/// 是否修改
28+
/// </summary>
2729
public bool IsModify => IsChanged().isChanged;
2830

2931

32+
/// <summary>
33+
///
34+
/// </summary>
35+
/// <returns></returns>
3036
public override string ToString()
3137
{
3238
return $"{base.ToString()}[Id={Id}]";
@@ -41,11 +47,19 @@ public void AfterLoadFromDB(bool isNew)
4147
stateHash = new StateHash(this, isNew);
4248
}
4349

50+
/// <summary>
51+
/// 是否修改
52+
/// </summary>
53+
/// <returns></returns>
4454
public (bool isChanged, byte[] data) IsChanged()
4555
{
4656
return stateHash.IsChanged();
4757
}
4858

59+
/// <summary>
60+
/// 是否由ID引起的变化
61+
/// </summary>
62+
/// <returns></returns>
4963
public (bool isChanged, long stateId, byte[] data) IsChangedWithId()
5064
{
5165
var res = stateHash.IsChanged();
@@ -69,6 +83,9 @@ public void BeforeSaveToDB()
6983
// table.Set(saveState.Key, saveState);
7084
}
7185

86+
/// <summary>
87+
///
88+
/// </summary>
7289
public void AfterSaveToDB()
7390
{
7491
stateHash.AfterSaveToDb();

DataBaseServer/GameFrameX.DBServer/State/ICacheState.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace GameFrameX.DBServer.State;
22

3+
/// <summary>
4+
/// 缓存数据对象接口
5+
/// </summary>
36
public interface ICacheState : ISafeDelete, ISafeCreate, ISafeUpdate
47
{
58
/// <summary>
@@ -18,5 +21,8 @@ public interface ICacheState : ISafeDelete, ISafeCreate, ISafeUpdate
1821
/// <param name="isNew"></param>
1922
void AfterLoadFromDB(bool isNew);
2023

24+
/// <summary>
25+
///
26+
/// </summary>
2127
void AfterSaveToDB();
2228
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace GameFrameX.DBServer.State;
22

3+
/// <summary>
4+
///
5+
/// </summary>
36
public abstract class InnerState
47
{
58
}

DataBaseServer/GameFrameX.DBServer/Storage/xxHashExtension.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
namespace GameFrameX.DBServer.Storage;
22

3+
/// <summary>
4+
/// XXHash扩展
5+
/// </summary>
36
public static class XxHashExtension
47
{
58
/// <summary>

0 commit comments

Comments
 (0)