Exemplo n.º 1
0
        // This method runs validators (both builtin and ones in description).
        // Precondition: EnsureInvariants() should already have been called.
        void Validate(bool runOperationValidators, bool isForService)
        {
            // contract behaviors
            ContractDescription contract = Contract;

            for (int j = 0; j < contract.ContractBehaviors.Count; j++)
            {
                IContractBehavior iContractBehavior = contract.ContractBehaviors[j];
                iContractBehavior.Validate(contract, this);
            }
            // endpoint behaviors
            for (int j = 0; j < EndpointBehaviors.Count; j++)
            {
                IEndpointBehavior ieb = EndpointBehaviors[j];
                ieb.Validate(this);
            }
            // operation behaviors
            if (runOperationValidators)
            {
                for (int j = 0; j < contract.Operations.Count; j++)
                {
                    OperationDescription op = contract.Operations[j];
                    TaskOperationDescriptionValidator.Validate(op, isForService);
                    for (int k = 0; k < op.OperationBehaviors.Count; k++)
                    {
                        IOperationBehavior iob = op.OperationBehaviors[k];
                        iob.Validate(op);
                    }
                }
            }
        }
Exemplo n.º 2
0
        // This method runs validators (both builtin and ones in description).
        // Precondition: EnsureInvariants() should already have been called.
        void Validate(bool runOperationValidators, bool isForService)
        {
            // contract behaviors
            ContractDescription contract = this.Contract;

            for (int j = 0; j < contract.Behaviors.Count; j++)
            {
                IContractBehavior iContractBehavior = contract.Behaviors[j];
                iContractBehavior.Validate(contract, this);
            }
            // endpoint behaviors
            if (!isForService)
            {
                (PartialTrustValidationBehavior.Instance as IEndpointBehavior).Validate(this);
#pragma warning disable 0618
                (PeerValidationBehavior.Instance as IEndpointBehavior).Validate(this);
#pragma warning restore 0618
                (TransactionValidationBehavior.Instance as IEndpointBehavior).Validate(this);
                (SecurityValidationBehavior.Instance as IEndpointBehavior).Validate(this);
                (System.ServiceModel.MsmqIntegration.MsmqIntegrationValidationBehavior.Instance as IEndpointBehavior).Validate(this);
            }
            for (int j = 0; j < this.Behaviors.Count; j++)
            {
                IEndpointBehavior ieb = this.Behaviors[j];
                ieb.Validate(this);
            }
            // operation behaviors
            if (runOperationValidators)
            {
                for (int j = 0; j < contract.Operations.Count; j++)
                {
                    OperationDescription op = contract.Operations[j];
                    TaskOperationDescriptionValidator.Validate(op, isForService);
                    for (int k = 0; k < op.Behaviors.Count; k++)
                    {
                        IOperationBehavior iob = op.Behaviors[k];
                        iob.Validate(op);
                    }
                }
            }
        }
 /// <summary>
 /// Implement to confirm that the contract and endpoint can support the contract behavior.
 /// </summary>
 /// <param name="contractDescription">The contract to validate.</param>
 /// <param name="endpoint">The endpoint to validate.</param>
 public void Validate(ContractDescription contractDescription, ServiceEndpoint endpoint)
 {
     contractBehavior.Validate(contractDescription, endpoint);
 }