[Mono-dev] (WCF) Binding elements order
Atsushi Eno
atsushieno at veritas-vos-liberabit.com
Wed Jul 7 01:49:06 EDT 2010
Hello Thiago,
In what kind of situation does this bring an issue? Is it like, a
binding element after a
TransportBindingElement should not be ignored under certain usage?
For reference, there is a test named
BuildChannelFactoryIgnoresRemaining() in HttpTransportBindingElementTest
in our nunit test that confirms that InvalidBindingElement is ignored
after a transport binding element. (If it is not ignored and called
BuildChannelFactory<T>(), then it throws NotSupportedException.)
[Test]
public void BuildChannelFactoryIgnoresRemaining ()
{
BindingContext ctx = new BindingContext (
new CustomBinding (
new HttpTransportBindingElement (),
new InvalidBindingElement ()),
empty_params);
ctx.BuildInnerChannelFactory<IRequestChannel> ();
}
Atsushi Eno
On 2010/07/06 21:34, Thiago Padilha wrote:
> Hi Atsushi,
>
> While examining the file "Binding.cs" I found the following comment
> on the two overloads of "CreateContext" method :
>
> "
> // FIXME: it seems that binding elements are
> // "validated" so that the last item is a transport.
> "
> If you were unsure about where the binding elements should be
> ordered take a look at this :
> http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.binding.createbindingelements.aspx
> According to this document, the ordering should be done inside the
> "CreateBindingElements" method for any class that inherits from
> "Binding". This could be fixed by using the following code in
> "CustomBinding.cs" :
>
> public override BindingElementCollection CreateBindingElements ()
> {
> return new BindingElementCollection (elements.OrderBy (be =>
> {
> Type t = be.GetType ();
> if (typeof(TransportBindingElement).IsAssignableFrom (t))
> return 2;
> if (typeof(MessageEncodingBindingElement).IsAssignableFrom (t))
> return 1;
> return 0;
> }));
> }
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
>
More information about the Mono-devel-list
mailing list