File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
GameFrameX.Core/Components Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -108,13 +108,26 @@ internal override bool ReadyToInactive
108108 get { return State == null || ! State . IsModify ( ) ; }
109109 }
110110
111+ /// <summary>
112+ /// 激活状态的时候异步读取数据
113+ /// </summary>
114+ /// <returns>返回查询的数据结果对象,没有数据返回null</returns>
115+ protected virtual Task < TState > ActiveReadStateAsync ( )
116+ {
117+ return null ;
118+ }
119+
111120 /// <summary>
112121 /// 准备状态
113122 /// </summary>
114123 /// <returns></returns>
115124 public async Task ReadStateAsync ( )
116125 {
117- State = await GameDb . FindAsync < TState > ( ActorId ) ;
126+ State = await ActiveReadStateAsync ( ) ;
127+ if ( State . IsNull ( ) )
128+ {
129+ State = await GameDb . FindAsync < TState > ( ActorId ) ;
130+ }
118131
119132 StateDic . TryRemove ( State . Id , out _ ) ;
120133 StateDic . TryAdd ( State . Id , State ) ;
You can’t perform that action at this time.
0 commit comments