Esempio n. 1
0
        public async Task <List <T> > QueryBatch <T>(List <long> ids, bool needCache = true) where T : Disposer
        {
            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 (Disposer disposer in dbQueryBatchResponse.Disposers)
            {
                list.Add((T)disposer);
            }
            return(list);
        }
Esempio n. 2
0
        public async Task <List <T> > QueryBatch <T>(List <long> ids, bool needCache = true) where T : Entity
        {
            List <T>             list    = new List <T>();
            Session              session = Game.Scene.GetComponent <NetInnerComponent>().Get(dbAddress);
            DBQueryBatchResponse dbQueryBatchResponse = await session.Call <DBQueryBatchResponse>(new DBQueryBatchRequest { CollectionName = typeof(T).Name, IdList = ids, NeedCache = needCache });

            foreach (Entity entity in dbQueryBatchResponse.Entitys)
            {
                list.Add((T)entity);
            }
            return(list);
        }