public async Task <T> GetSingleEntityAsync <T>(string operationName, Dictionary <string, object> paramsObject, QueryObject queryObject, string returnTypeName) where T : class, IDerivedEntity { //BusyIndicator.instance.start(); var resultSerialResponseToken = await this.dataAdapter.CallEntityFunctionAsync(operationName, paramsObject, queryObject, returnTypeName, false); var resultSerialResponse = resultSerialResponseToken.ToObject <ResultSingleSerialData>(); //BusyIndicator.instance.stop(); var derivedEntity = this.dataContext.AttachSingleEntitiy(resultSerialResponse); return((T)derivedEntity); }
public async Task <QueryResult <T> > GetEntitiesAsync <T>(string operationName, Dictionary <string, object> paramsObject, QueryObject queryObject, string returnTypeName) where T : class, IDerivedEntity { var dataSet = new List <T>(); var totalCount = 0; //BusyIndicator.instance.start(); var resultSerialResponseToken = await this.dataAdapter.CallEntityFunctionAsync(operationName, paramsObject, queryObject, returnTypeName, true); var resultSerialResponse = resultSerialResponseToken.ToObject <ResultSerialResponse>(); var tempDataSet = this.dataContext.AttachEntities(resultSerialResponse.Data).Select(it => (T)it); dataSet.AddRange(tempDataSet); var moreData = resultSerialResponse != null && !string.IsNullOrEmpty(resultSerialResponse.NextLink); while (moreData) { resultSerialResponseToken = await this.dataAdapter.QueryAllNextAsync(resultSerialResponse.NextLink); resultSerialResponse = resultSerialResponseToken.ToObject <ResultSerialResponse>(); tempDataSet = this.dataContext.AttachEntities(resultSerialResponse.Data).Select(it => (T)it); dataSet.AddRange(tempDataSet); totalCount = resultSerialResponse.Data.TotalCount; moreData = resultSerialResponse != null && !string.IsNullOrEmpty(resultSerialResponse.NextLink); } //BusyIndicator.instance.stop(); var queryResult = new QueryResult <T>() { Rows = dataSet, TotalRows = totalCount }; return(queryResult); }