protected override async void Run(Session session, DBQueryJsonRequest message, Action <DBQueryJsonResponse> reply)
        {
            DBQueryJsonResponse response = new DBQueryJsonResponse();

            try
            {
                DBCacheComponent dbCacheComponent = Game.Scene.GetComponent <DBCacheComponent>();
                List <Disposer>  disposers        = await dbCacheComponent.GetJson(message.CollectionName, message.Json);

                response.Disposers = disposers;

                if (message.NeedCache)
                {
                    foreach (Disposer disposer in disposers)
                    {
                        dbCacheComponent.AddToCache(disposer, message.CollectionName);
                    }
                }

                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
Exemple #2
0
        protected override async ETTask Run(Session session, DBQueryJsonRequest request, DBQueryJsonResponse response, Action reply)
        {
            try
            {
                DBCacheComponent       dbCacheComponent = Game.Scene.GetComponent <DBCacheComponent>();
                List <ComponentWithId> components       = await dbCacheComponent.GetJson(request.CollectionName, request.Json);

                response.Components = components;

                reply();
                await ETTask.CompletedTask;
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }
        protected override async void Run(Session session, DBQueryJsonRequest message, Action <DBQueryJsonResponse> reply)
        {
            DBQueryJsonResponse response = new DBQueryJsonResponse();

            try
            {
                DBCacheComponent       dbCacheComponent = Game.Scene.GetComponent <DBCacheComponent>();
                List <ComponentWithId> components       = await dbCacheComponent.GetJson(message.CollectionName, message.Json);

                response.Components = components;
                reply(response);
            }
            catch (Exception e)
            {
                ReplyError(response, e, reply);
            }
        }