Esempio n. 1
0
 public CustomPolicyConversionContext(WS.Binding binding, ServiceEndpoint endpoint)
     : base(endpoint)
 {
     this.binding     = binding;
     assertions       = new PolicyAssertionCollection();
     binding_elements = ((CustomBinding)endpoint.Binding).Elements;
 }
Esempio n. 2
0
 internal ExportedPolicyConversionContext(ServiceEndpoint endpoint) : base(endpoint)
 {
     this.bindingElements            = endpoint.Binding.CreateBindingElements();
     this.bindingAssertions          = new PolicyAssertionCollection();
     this.operationBindingAssertions = new Dictionary <OperationDescription, PolicyAssertionCollection>();
     this.messageBindingAssertions   = new Dictionary <MessageDescription, PolicyAssertionCollection>();
     this.faultBindingAssertions     = new Dictionary <FaultDescription, PolicyAssertionCollection>();
 }
            ImportedPolicyConversionContext(ServiceEndpoint endpoint, IEnumerable <XmlElement> endpointAssertions,
                                            Dictionary <OperationDescription, IEnumerable <XmlElement> > operationBindingAssertions,
                                            Dictionary <MessageDescription, IEnumerable <XmlElement> > messageBindingAssertions,
                                            Dictionary <FaultDescription, IEnumerable <XmlElement> > faultBindingAssertions,
                                            MetadataImporterQuotas quotas)
                : base(endpoint)
            {
                int remainingAssertionsAllowed = quotas.MaxPolicyAssertions;

                this.endpointAssertions = new PolicyAssertionCollection(new MaxItemsEnumerable <XmlElement>(endpointAssertions, remainingAssertionsAllowed));

                remainingAssertionsAllowed -= this.endpointAssertions.Count;

                foreach (OperationDescription operationDescription in endpoint.Contract.Operations)
                {
                    this.operationBindingAssertions.Add(operationDescription, new PolicyAssertionCollection());

                    foreach (MessageDescription messageDescription in operationDescription.Messages)
                    {
                        this.messageBindingAssertions.Add(messageDescription, new PolicyAssertionCollection());
                    }

                    foreach (FaultDescription faultDescription in operationDescription.Faults)
                    {
                        this.faultBindingAssertions.Add(faultDescription, new PolicyAssertionCollection());
                    }
                }


                foreach (KeyValuePair <OperationDescription, IEnumerable <XmlElement> > entry in operationBindingAssertions)
                {
                    this.operationBindingAssertions[entry.Key].AddRange(new MaxItemsEnumerable <XmlElement>(entry.Value, remainingAssertionsAllowed));
                    remainingAssertionsAllowed -= this.operationBindingAssertions[entry.Key].Count;
                }

                foreach (KeyValuePair <MessageDescription, IEnumerable <XmlElement> > entry in messageBindingAssertions)
                {
                    this.messageBindingAssertions[entry.Key].AddRange(new MaxItemsEnumerable <XmlElement>(entry.Value, remainingAssertionsAllowed));
                    remainingAssertionsAllowed -= this.messageBindingAssertions[entry.Key].Count;
                }

                foreach (KeyValuePair <FaultDescription, IEnumerable <XmlElement> > entry in faultBindingAssertions)
                {
                    this.faultBindingAssertions[entry.Key].AddRange(new MaxItemsEnumerable <XmlElement>(entry.Value, remainingAssertionsAllowed));
                    remainingAssertionsAllowed -= this.faultBindingAssertions[entry.Key].Count;
                }
            }
 public CustomPolicyConversionContext(ServiceEndpoint endpoint)
     : base(endpoint)
 {
     assertions       = new PolicyAssertionCollection();
     binding_elements = endpoint.Binding.CreateBindingElements();
 }
Esempio n. 5
0
 internal BindingOnlyPolicyConversionContext(ServiceEndpoint endpoint, IEnumerable <XmlElement> bindingPolicy)
     : base(endpoint)
 {
     _bindingPolicy = new PolicyAssertionCollection(bindingPolicy);
 }