Exemple #1
0
        public async Task <List <T> > QueryJson <T>(string json, bool needCache = true) where T : Disposer
        {
            List <T>            list                = new List <T>();
            Session             session             = Game.Scene.GetComponent <NetInnerComponent>().Get(dbAddress);
            DBQueryJsonResponse dbQueryJsonResponse = (DBQueryJsonResponse)await session.Call(new DBQueryJsonRequest { CollectionName = typeof(T).Name, Json = json, NeedCache = needCache });

            foreach (Disposer disposer in dbQueryJsonResponse.Disposers)
            {
                list.Add((T)disposer);
            }
            return(list);
        }
Exemple #2
0
        public async Task <List <T> > QueryJson <T>(string json, bool needCache = true) where T : Entity
        {
            List <T>            list                = new List <T>();
            Session             session             = Game.Scene.GetComponent <NetInnerComponent>().Get(dbAddress);
            DBQueryJsonResponse dbQueryJsonResponse = await session.Call <DBQueryJsonResponse>(new DBQueryJsonRequest { CollectionName = typeof(T).Name, Json = json, NeedCache = needCache });

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