Esempio n. 1
0
 protected IExpandedResult GetSkipToken(IExpandedResult expanded)
 {
     if (((expanded != null) && !this.IsCustomPaged) && !this.RequestDescription.IsRequestForEnumServiceOperation)
     {
         return(expanded.GetExpandedPropertyValue("$skiptoken") as IExpandedResult);
     }
     return(null);
 }
Esempio n. 2
0
        protected object GetExpandedProperty(IExpandedResult expanded, object customObject, ResourceProperty property, ExpandedProjectionNode expandedNode)
        {
            if (expanded == null)
            {
                return(WebUtil.GetPropertyValue(this.Provider, customObject, null, property, null));
            }
            string name = property.Name;

            if ((expandedNode != null) && (this.GetCurrentExpandedProjectionNode().ResourceType != expandedNode.TargetResourceType))
            {
                name = expandedNode.TargetResourceType.FullName + "/" + property.Name;
            }
            return(expanded.GetExpandedPropertyValue(name));
        }
Esempio n. 3
0
 /// <summary>
 /// Gets the skip token object contained in the expanded result for standard paging.
 /// </summary>
 /// <param name="expanded">Current expanded result.</param>
 /// <returns>Skip token object if any.</returns>
 protected IExpandedResult GetSkipToken(IExpandedResult expanded)
 {
     if (expanded != null && !this.IsCustomPaged && !this.RequestDescription.IsRequestForEnumServiceOperation)
     {
         return expanded.GetExpandedPropertyValue(XmlConstants.HttpQueryStringSkipToken) as IExpandedResult;
     }
     
     return null;
 }
Esempio n. 4
0
 /// <summary>Gets the expandable value for the specified object.</summary>
 /// <param name="provider">underlying data source instance.</param>
 /// <param name="expanded">Expanded properties for the result, possibly null.</param>
 /// <param name="customObject">Object with value to retrieve.</param>
 /// <param name="property">Property for which value will be retrieved.</param>
 /// <returns>The property value.</returns>
 protected static object GetExpandedProperty(DataServiceProviderWrapper provider, IExpandedResult expanded, object customObject, ResourceProperty property)
 {
     Debug.Assert(property != null, "property != null");
     if (expanded == null)
     {
         return WebUtil.GetPropertyValue(provider, customObject, null, property, null);
     }
     else
     {
         // We may end up projecting null as a value of ResourceSetReference property. This can in theory break
         //   the serializers as they expect a non-null (possibly empty) IEnumerable instead. But note that
         //   if we project null into the expanded property, we also project null into the ExpandedElement property
         //   and thus the serializers should recognize this value as null and don't try to expand its properties.
         Debug.Assert(
             expanded.ExpandedElement != null, 
             "We should not be accessing expanded properties on null resource.");
         return expanded.GetExpandedPropertyValue(property.Name);
     }
 }