Exemplo n.º 1
0
        public static async ETTask <List <ComponentWithId> > Query <T>(this DBProxyComponent self, List <long> ids, bool needCache = true) where T : ComponentWithId
        {
            Session session = Game.Scene.GetComponent <NetInnerComponent>().Get(self.dbAddress);
            DBQueryBatchResponse dbQueryBatchResponse = (DBQueryBatchResponse)await session.Call(new DBQueryBatchRequest { CollectionName = typeof(T).Name, IdList = ids, NeedCache = needCache });

            return(dbQueryBatchResponse.Components);
        }
Exemplo n.º 2
0
        public static async Task <List <T> > QueryBatch <T>(this DBProxyComponent self, List <long> ids, bool needCache = true) where T : ComponentWithId
        {
            List <T>             list    = new List <T>();
            Session              session = Game.Scene.GetComponent <NetInnerComponent>().Get(self.dbAddress);
            DBQueryBatchResponse dbQueryBatchResponse = (DBQueryBatchResponse)await session.Call(new DBQueryBatchRequest { CollectionName = typeof(T).Name, IdList = ids, NeedCache = needCache });

            foreach (ComponentWithId component in dbQueryBatchResponse.Components)
            {
                list.Add((T)component);
            }
            return(list);
        }