public void Add(MessageFilter filter, FilterData data) { SecuritySessionFilter sessionFilter = filter as SecuritySessionFilter; if (sessionFilter == null) { Fx.Assert(String.Format(CultureInfo.InvariantCulture, "Unknown filter type {0}", filter.GetType())); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.Format(SR.UnknownFilterType, filter.GetType()))); } if (sessionFilter.standardsManager != this.standardsManager) { Fx.Assert("Standards manager of filter does not match that of filter table"); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.StandardsManagerDoesNotMatch)); } if (sessionFilter.isStrictMode != this.isStrictMode) { Fx.Assert("Session filter's isStrictMode differs from filter table's isStrictMode"); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.FilterStrictModeDifferent)); } if (this.contextMappings.ContainsKey(sessionFilter.SecurityContextTokenId)) { Fx.Assert(SR.Format(SR.SecuritySessionIdAlreadyPresentInFilterTable, sessionFilter.SecurityContextTokenId)); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.SecuritySessionIdAlreadyPresentInFilterTable, sessionFilter.SecurityContextTokenId))); } this.filterMappings.Add(filter, data); this.contextMappings.Add(sessionFilter.SecurityContextTokenId, new KeyValuePair <MessageFilter, FilterData>(filter, data)); }
public void Add(MessageFilter filter, FilterData data) { SecuritySessionFilter filter2 = filter as SecuritySessionFilter; if (filter2 == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("UnknownFilterType", new object[] { filter.GetType() }))); } if (filter2.standardsManager != this.standardsManager) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("StandardsManagerDoesNotMatch"))); } if (filter2.isStrictMode != this.isStrictMode) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("FilterStrictModeDifferent"))); } if (this.contextMappings.ContainsKey(filter2.SecurityContextTokenId)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("SecuritySessionIdAlreadyPresentInFilterTable", new object[] { filter2.SecurityContextTokenId }))); } this.filterMappings.Add(filter, data); this.contextMappings.Add(filter2.SecurityContextTokenId, new KeyValuePair <MessageFilter, FilterData>(filter, data)); }