public override void PreprocessObjectToWrite(ref object objectToWrite, ObjectGraphInfo info) { AstoriaHelper.PreprocessObjectToWrite(ref objectToWrite, info); }
internal static void PreprocessObjectToWrite(ref object objectToWrite, ObjectGraphInfo info) { if (objectToWrite is DataServiceQuery) { objectToWrite = ((DataServiceQuery) objectToWrite).Execute(); } if (objectToWrite is QueryOperationResponse) { QueryOperationResponse qor = (QueryOperationResponse) objectToWrite; if (qor.GetType().IsGenericType && (qor.GetType().GetGenericTypeDefinition() == typeof(QueryOperationResponse<>))) { objectToWrite = Util.VerticalRun(new object[] { new QueryOperationResponseWrapper(true, qor), new QueryOperationResponseWrapper(false, qor) }); } } else if (objectToWrite is QueryOperationResponseWrapper) { QueryOperationResponseWrapper wrapper = (QueryOperationResponseWrapper) objectToWrite; if (wrapper.Enumerate) { objectToWrite = wrapper.Qor; } else { DataServiceQueryContinuation continuation = wrapper.Qor.GetContinuation(); if (!((continuation == null) || wrapper.ElementType.Name.Contains<char>('<'))) { Uri nextLinkUri = continuation.NextLinkUri; objectToWrite = new Hyperlinq(QueryLanguage.Expression, "Execute<" + wrapper.ElementType.Name + "> (new Uri (\"" + nextLinkUri.ToString() + "\"))", "Next Page"); } else { objectToWrite = info.DisplayNothingToken; } } } else { DataServiceQueryException exception = objectToWrite as DataServiceQueryException; if ((exception != null) && (exception.InnerException is DataServiceClientException)) { DataServiceClientException innerException = (DataServiceClientException) exception.InnerException; try { XElement element = XElement.Parse(innerException.Message); if (element.Name.LocalName == "error") { XNamespace namespace2 = element.Name.Namespace; string str = (string) element.Element((XName) (namespace2 + "message")); if (!string.IsNullOrEmpty(str)) { str = str.Trim(); if (str.EndsWith("cannot be used in a query")) { str = str + " predicate"; } if (!str.EndsWith(".")) { str = str + "."; } Util.Highlight(str + " See exception below for more details.").Dump<object>(); } } } catch { } } } }
public override void PreprocessObjectToWrite(ref object objectToWrite, ObjectGraphInfo info) { if (objectToWrite is DataServiceQuery) objectToWrite = ((DataServiceQuery)objectToWrite).Execute(); /*if (objectToWrite.GetType().GetGenericTypeDefinition() == typeof(DataServiceQuerySingle<>)) { var methodInfo = objectToWrite.GetType().GetMethod("GetValue"); methodInfo.Invoke(objectToWrite, null); }*/ }
public virtual void PreprocessObjectToWrite(ref object objectToWrite, ObjectGraphInfo info) { }
public override void PreprocessObjectToWrite(ref object objectToWrite, ObjectGraphInfo info) { AstoriaHelper.PreprocessObjectToWrite(ref objectToWrite, info); }
internal static void PreprocessObjectToWrite(ref object objectToWrite, ObjectGraphInfo info) { if (objectToWrite is DataServiceQuery) { objectToWrite = ((DataServiceQuery)objectToWrite).Execute(); } if (objectToWrite is QueryOperationResponse) { QueryOperationResponse qor = (QueryOperationResponse)objectToWrite; if (qor.GetType().IsGenericType&& (qor.GetType().GetGenericTypeDefinition() == typeof(QueryOperationResponse <>))) { objectToWrite = Util.VerticalRun(new object[] { new QueryOperationResponseWrapper(true, qor), new QueryOperationResponseWrapper(false, qor) }); } } else if (objectToWrite is QueryOperationResponseWrapper) { QueryOperationResponseWrapper wrapper = (QueryOperationResponseWrapper)objectToWrite; if (wrapper.Enumerate) { objectToWrite = wrapper.Qor; } else { DataServiceQueryContinuation continuation = wrapper.Qor.GetContinuation(); if (!((continuation == null) || wrapper.ElementType.Name.Contains <char>('<'))) { Uri nextLinkUri = continuation.NextLinkUri; objectToWrite = new Hyperlinq(QueryLanguage.Expression, "Execute<" + wrapper.ElementType.Name + "> (new Uri (\"" + nextLinkUri.ToString() + "\"))", "Next Page"); } else { objectToWrite = info.DisplayNothingToken; } } } else { DataServiceQueryException exception = objectToWrite as DataServiceQueryException; if ((exception != null) && (exception.InnerException is DataServiceClientException)) { DataServiceClientException innerException = (DataServiceClientException)exception.InnerException; try { XElement element = XElement.Parse(innerException.Message); if (element.Name.LocalName == "error") { XNamespace namespace2 = element.Name.Namespace; string str = (string)element.Element((XName)(namespace2 + "message")); if (!string.IsNullOrEmpty(str)) { str = str.Trim(); if (str.EndsWith("cannot be used in a query")) { str = str + " predicate"; } if (!str.EndsWith(".")) { str = str + "."; } Util.Highlight(str + " See exception below for more details.").Dump <object>(); } } } catch { } } } }
public virtual void PreprocessObjectToWrite(ref object objectToWrite, ObjectGraphInfo info) { }