/// <summary>
 /// Unit test method for determining whether two facades are equivalent (ie: wrap the same server/client models).
 /// </summary>
 /// <param name="other">The other facade.</param>
 /// <returns>
 ///   <c>true</c> if the two facades wrap the same models; otherwise, <c>false</c>.
 /// </returns>
 internal bool IsEquivalentTo(PayloadMetadataParameterInterpreter other)
 {
     return(other != null &&
            other.isJsonLight == this.isJsonLight &&
            other.metadataParameterValue == this.metadataParameterValue &&
            other.metadataParameterValueForTypeNames == this.metadataParameterValueForTypeNames);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="OperationSerializer"/> class.
        /// </summary>
        /// <param name="payloadMetadataParameterInterpreter">The metadata query option interpreter </param>
        /// <param name="metadataPropertyManager">The metadata property manager.</param>
        /// <param name="advertiseServiceAction">The callback to use for determining whether an action should be advertised. Should wrap a call to IDataServiceActionProvider.AdvertiseServiceAction.</param>
        /// <param name="namespaceName">Namespace of the operation.</param>
        /// <param name="format">The current format being serialized into.</param>
        /// <param name="metadataUri">The metadata uri of the service.</param>
        internal OperationSerializer(
            PayloadMetadataParameterInterpreter payloadMetadataParameterInterpreter,
            PayloadMetadataPropertyManager metadataPropertyManager, 
            AdvertiseServiceActionCallback advertiseServiceAction, 
            string namespaceName, 
            ODataFormat format, 
            Uri metadataUri)
        {
            Debug.Assert(metadataPropertyManager != null, "metadataPropertyManager != null");
            Debug.Assert(payloadMetadataParameterInterpreter != null, "payloadMetadataParameterInterpreter != null");
            Debug.Assert(advertiseServiceAction != null, "advertiseServiceAction != null");

            this.payloadMetadataParameterInterpreter = payloadMetadataParameterInterpreter;
            this.metadataPropertyManager = metadataPropertyManager;

            this.operationLinkBuilder = new OperationLinkBuilder(namespaceName, metadataUri);
            this.format = format;
            this.metadataUri = metadataUri;
            
            this.advertiseServiceAction = advertiseServiceAction;
        }
示例#3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="OperationSerializer"/> class.
        /// </summary>
        /// <param name="payloadMetadataParameterInterpreter">The metadata query option interpreter </param>
        /// <param name="metadataPropertyManager">The metadata property manager.</param>
        /// <param name="advertiseServiceAction">The callback to use for determining whether an action should be advertised. Should wrap a call to IDataServiceActionProvider.AdvertiseServiceAction.</param>
        /// <param name="namespaceName">Namespace of the operation.</param>
        /// <param name="format">The current format being serialized into.</param>
        /// <param name="metadataUri">The metadata uri of the service.</param>
        internal OperationSerializer(
            PayloadMetadataParameterInterpreter payloadMetadataParameterInterpreter,
            PayloadMetadataPropertyManager metadataPropertyManager,
            AdvertiseServiceActionCallback advertiseServiceAction,
            string namespaceName,
            ODataFormat format,
            Uri metadataUri)
        {
            Debug.Assert(metadataPropertyManager != null, "metadataPropertyManager != null");
            Debug.Assert(payloadMetadataParameterInterpreter != null, "payloadMetadataParameterInterpreter != null");
            Debug.Assert(advertiseServiceAction != null, "advertiseServiceAction != null");

            this.payloadMetadataParameterInterpreter = payloadMetadataParameterInterpreter;
            this.metadataPropertyManager             = metadataPropertyManager;

            this.operationLinkBuilder = new OperationLinkBuilder(namespaceName, metadataUri);
            this.format      = format;
            this.metadataUri = metadataUri;

            this.advertiseServiceAction = advertiseServiceAction;
        }
        private static OperationSerializer CreateOperationSerializer(AdvertiseServiceActionCallback advertiseServiceActionCallback)
        {
            var parameterInterpreter = new PayloadMetadataParameterInterpreter(ODataFormat.Json, "full");
            var propertyManager = new PayloadMetadataPropertyManager(parameterInterpreter);

            return new OperationSerializer(parameterInterpreter, propertyManager, advertiseServiceActionCallback, "MyContainer", ODataFormat.Json, new Uri("http://odata.org/Service.svc/$metadata"));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PayloadMetadataPropertyManager"/> class.
 /// </summary>
 /// <param name="interpreter">The interpreter for the query option.</param>
 internal PayloadMetadataPropertyManager(PayloadMetadataParameterInterpreter interpreter)
 {
     Debug.Assert(interpreter != null, "interpreter != null");
     this.interpreter = interpreter;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PayloadMetadataPropertyManager"/> class.
 /// </summary>
 /// <param name="interpreter">The interpreter for the query option.</param>
 internal PayloadMetadataPropertyManager(PayloadMetadataParameterInterpreter interpreter)
 {
     Debug.Assert(interpreter != null, "interpreter != null");
     this.interpreter = interpreter;
 }
 /// <summary>
 /// Unit test method for determining whether two facades are equivalent (ie: wrap the same server/client models).
 /// </summary>
 /// <param name="other">The other facade.</param>
 /// <returns>
 ///   <c>true</c> if the two facades wrap the same models; otherwise, <c>false</c>.
 /// </returns>
 internal bool IsEquivalentTo(PayloadMetadataParameterInterpreter other)
 {
     return other != null
         && other.isJsonLight == this.isJsonLight
         && other.metadataParameterValue == this.metadataParameterValue
         && other.metadataParameterValueForTypeNames == this.metadataParameterValueForTypeNames;
 }