示例#1
0
        public async Task <object> ExecuteQuery <T>(DataManagerRequest queries)
        {
            if (this.Adaptor == Adaptors.CustomAdaptor)
            {
                return(await this.BaseAdaptor.Read(queries));
            }
            if (this.DataAdaptor != null && this.DataAdaptor.IsRemote())
            {
                if (this.Offline)
                {
                    return(await this.ProcessOffline <T>(queries));
                }
                this.DataAdaptor.SetModelType(typeof(T));
                HttpRequestMessage request1 = this.HttpHandler.PrepareRequest(this.DataAdaptor?.ProcessQuery(queries) as RequestOptions);
                this.BeforeSend(request1);
                return(await this.DataAdaptor?.ProcessResponse <T>(await this.DataAdaptor?.PerformDataOperation <T>((object)request1), queries));
            }
            DataManagerRequest request = (DataManagerRequest)this.DataAdaptor?.ProcessQuery(queries);

            return(await this.DataAdaptor?.ProcessResponse <T>(await this.DataAdaptor?.PerformDataOperation <T>((object)request), request));
        }
示例#2
0
        public async Task <object> ProcessOffline <T>(DataManagerRequest queries)
        {
            DataManager        dataManager = this;
            DataManagerRequest query       = new DataManagerRequest();
            object             obj1        = dataManager.DataAdaptor.ProcessQuery(query);
            HttpRequestMessage request     = dataManager.HttpHandler.PrepareRequest(obj1 as RequestOptions);

            dataManager.BeforeSend(request);
            object Data1 = await dataManager.DataAdaptor.PerformDataOperation <T>((object)request);

            object obj2 = await dataManager.DataAdaptor.ProcessResponse <T>(Data1, query);

            dataManager.Json        = (IEnumerable <object>)obj2;
            dataManager.DataAdaptor = (IAdaptor) new BlazorAdaptor(dataManager);
            DataManagerRequest request1 = (DataManagerRequest)dataManager.DataAdaptor.ProcessQuery(queries);
            object             Data2    = await dataManager.DataAdaptor.PerformDataOperation <T>((object)request1);

            object obj3 = await dataManager.DataAdaptor.ProcessResponse <T>(Data2, request1);

            query    = (DataManagerRequest)null;
            request1 = (DataManagerRequest)null;
            return(obj3);
        }