Exemplo n.º 1
0
        /// <summary>Updates the response version based on response format and given resource type</summary>
        /// <param name="acceptTypesText">text for Accepts header content required to infere response format</param>
        /// <param name="resourceSet">resourceSet to check for friendly feeds presence</param>
        /// <param name="provider">data service provider instance</param>
        /// <returns>The instance for which the update of response version happens</returns>
        internal RequestDescription UpdateEpmResponseVersion(string acceptTypesText, ResourceSetWrapper resourceSet, DataServiceProviderWrapper provider)
        {
            Debug.Assert(provider != null, "provider != null");

            // Response will be 2.0 if any of the property in the types contained in the resource set has KeepInContent false
            if (this.TargetKind == RequestTargetKind.Resource)
            {
                Debug.Assert(resourceSet != null, "Must have valid resource set");
                if (!resourceSet.EpmIsV1Compatible(provider) && !this.LinkUri)
                {
                    // Friendly feeds must only bump the response version for Atom responses
                    if (WebUtil.IsAtomMimeType(acceptTypesText))
                    {
                        this.RaiseResponseVersion(2, 0);
                    }
                }
            }

            return this;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Raise the feature version if the given set contains any type with FF mapped properties that is KeepInContent=false.
        /// </summary>
        /// <param name="resourceSet">Resource set to test</param>
        /// <param name="service">service instance</param>
        /// <returns>This RequestDescription instance</returns>
        internal RequestDescription UpdateAndCheckEpmFeatureVersion(ResourceSetWrapper resourceSet, IDataService service)
        {
            Debug.Assert(resourceSet != null, "resourceSet != null");
            Debug.Assert(service != null, "provider != null");

            // For feature version we only look at the SET, and bump the version if it's not V1 compatible.  We do this even if the
            // target kind is not Resource.  So we could have request and response DSV be 1.0 while feature version be 2.0.
            if (!resourceSet.EpmIsV1Compatible(service.Provider))
            {
                this.RaiseFeatureVersion(2, 0, service.Configuration);
            }

            return this;
        }