Exemple #1
0
 public static async ETTask Save(this DBProxyComponent self, ComponentWithId component)
 {
     Session session = Game.Scene.GetComponent <NetInnerComponent>().Get(self.dbAddress);
     await session.Call(new DBSaveRequest { Component = component });
 }
Exemple #2
0
 public static async ETVoid SaveLog(this DBProxyComponent self, ComponentWithId component)
 {
     Session session = Game.Scene.GetComponent <NetInnerComponent>().Get(self.dbAddress);
     await session.Call(new DBSaveRequest { Component = component, CollectionName = "Log" });
 }
Exemple #3
0
 public static async ETTask SaveBatch(this DBProxyComponent self, List <ComponentWithId> components)
 {
     Session session = Game.Scene.GetComponent <NetInnerComponent>().Get(self.dbAddress);
     await session.Call(new DBSaveBatchRequest { Components = components });
 }
Exemple #4
0
        public static void Awake(this DBProxyComponent self)
        {
            StartConfig dbStartConfig = StartConfigComponent.Instance.DBConfig;

            self.dbAddress = dbStartConfig.GetComponent <InnerConfig>().IPEndPoint;
        }
Exemple #5
0
 /// <summary>
 /// 清空表
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="self"></param>
 /// <returns></returns>
 public static async ETTask DeleteAll <T>(this DBProxyComponent self)
 {
     DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>();
     var         filter      = Builders <ComponentWithId> .Filter.Empty;
     await dbComponent.GetCollection(typeof(T).Name).DeleteManyAsync(filter);
 }
Exemple #6
0
 /// <summary>
 /// 根据ID删除数据
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="self"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public static async ETTask Delete <T>(this DBProxyComponent self, long id)
 {
     DBComponent dbComponent = Game.Scene.GetComponent <DBComponent>();
     await dbComponent.GetCollection(typeof(T).Name).DeleteOneAsync(i => i.Id == id);
 }
Exemple #7
0
 public static async Task Save(this DBProxyComponent self, ComponentWithId component, bool needCache, CancellationToken cancellationToken)
 {
     Session session = Game.Scene.GetComponent <NetInnerComponent>().Get(self.dbAddress);
     await session.Call(new DBSaveRequest { Component = component, NeedCache = needCache }, cancellationToken);
 }
Exemple #8
0
 public void Awake()
 {
     Ins = this;
     dbProxyComponent = Game.Scene.GetComponent <DBProxyComponent>();
 }