private void ConfigureOperationDescriptionBehaviors(OperationDescription operation, IDataContractSurrogate contractSurrogate)
 {
     DataContractSerializerOperationBehavior item = new DataContractSerializerOperationBehavior(operation, TypeLoader.DefaultDataContractFormatAttribute);
     if (contractSurrogate != null)
     {
         item.DataContractSurrogate = contractSurrogate;
     }
     operation.Behaviors.Add(item);
     operation.Behaviors.Add(new OperationInvokerBehavior());
     if ((this.info.TransactionOption == TransactionOption.Supported) || (this.info.TransactionOption == TransactionOption.Required))
     {
         operation.Behaviors.Add(new TransactionFlowAttribute(TransactionFlowOption.Allowed));
     }
     OperationBehaviorAttribute attribute = new OperationBehaviorAttribute {
         TransactionAutoComplete = true,
         TransactionScopeRequired = false
     };
     operation.Behaviors.Add(attribute);
 }
        void ConfigureOperationDescriptionBehaviors(OperationDescription operation, IDataContractSurrogate contractSurrogate)
        {
            // DataContractSerializerOperationBehavior
            DataContractSerializerOperationBehavior contractSerializer = new DataContractSerializerOperationBehavior(operation, TypeLoader.DefaultDataContractFormatAttribute);

            if (null != contractSurrogate)
            {
                contractSerializer.DataContractSurrogate = contractSurrogate;
            }

            operation.Behaviors.Add(contractSerializer);

            // OperationInvokerBehavior
            operation.Behaviors.Add(new OperationInvokerBehavior());

            if (info.TransactionOption == TransactionOption.Supported || info.TransactionOption == TransactionOption.Required)
            {
                operation.Behaviors.Add(new TransactionFlowAttribute(TransactionFlowOption.Allowed));
            }

            // OperationBehaviorAttribute
            OperationBehaviorAttribute operationBehaviorAttribute = new OperationBehaviorAttribute();
            operationBehaviorAttribute.TransactionAutoComplete = true;
            operationBehaviorAttribute.TransactionScopeRequired = false;
            operation.Behaviors.Add(operationBehaviorAttribute);
        }
 private static void EnableTransactionBehavior(OperationDescription operationDescription)
 {
     OperationBehaviorAttribute attribute = operationDescription.Behaviors.Find<OperationBehaviorAttribute>();
     if (attribute != null)
     {
         attribute.TransactionScopeRequired = true;
         attribute.TransactionAutoComplete = false;
     }
     else
     {
         OperationBehaviorAttribute item = new OperationBehaviorAttribute {
             TransactionAutoComplete = false,
             TransactionScopeRequired = true
         };
         operationDescription.Behaviors.Add(item);
     }
     TransactionFlowAttribute attribute4 = operationDescription.Behaviors.Find<TransactionFlowAttribute>();
     if (attribute4 != null)
     {
         if (attribute4.Transactions != TransactionFlowOption.Allowed)
         {
             throw System.ServiceModel.Activities.FxTrace.Exception.AsError(new InvalidOperationException(System.ServiceModel.Activities.SR.ContractInferenceValidationForTransactionFlowBehavior));
         }
     }
     else if (!operationDescription.IsOneWay)
     {
         operationDescription.Behaviors.Add(new TransactionFlowAttribute(TransactionFlowOption.Allowed));
     }
 }