예제 #1
0
        public static async Task <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);
        }
예제 #2
0
        public async Task <List <T> > QueryBatch <T>(List <long> ids, bool needCache = true) where T : ComponentWithId
        {
            List <T>             list    = new List <T>();
            Session              session = Game.Scene.GetComponent <NetInnerComponent>().Get(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);
        }