|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Channels;
namespace SlasheneFramework.WCF
{
public class ListenUriBindingElement : BindingElement
{
public ListenUriBindingElement()
{
}
public ListenUriBindingElement(Uri listenUriBaseAddress)
{
this.listenUriBaseAddress = listenUriBaseAddress;
}
public override IChannelListener<TChannel> BuildChannelListener<TChannel>(BindingContext context)
{
if(listenUriBaseAddress != null)
context.ListenUriBaseAddress = listenUriBaseAddress;
return base.BuildChannelListener<TChannel>(context);
}
public override IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingContext context)
{
if(listenUriBaseAddress != null)
context.ListenUriBaseAddress = listenUriBaseAddress;
return base.BuildChannelFactory<TChannel>(context);
}
public override BindingElement Clone()
{
return new ListenUriBindingElement(listenUriBaseAddress);
}
public override T GetProperty<T>(BindingContext context)
{
return context.GetInnerProperty<T>();
}
public Uri ListenUriBaseAddress
{
get
{
return listenUriBaseAddress;
}
set
{
listenUriBaseAddress = value;
}
}
private Uri listenUriBaseAddress;
}
public class ReplyToBindingElement : BindingElement
{
public override BindingElement Clone()
{
return new ReplyToBindingElement();
}
public override IChannelFactory<TChannel> BuildChannelFactory<TChannel>(BindingContext context)
{
if(!CanBuildChannelFactory<TChannel>(context))
{
throw new ArgumentException("Impossible to build ReplyToBindingElement");
}
return (IChannelFactory<TChannel>)new ReplyToChannelFactory(context.ListenUriBaseAddress, (IChannelFactory<IOutputChannel>)base.BuildChannelFactory<TChannel>(context));
}
public override IChannelListener<TChannel> BuildChannelListener<TChannel>(BindingContext context)
{
return base.BuildChannelListener<TChannel>(context);
}
public override bool CanBuildChannelFactory<TChannel>(BindingContext context)
{
return typeof(TChannel) == typeof(IOutputChannel);
}
public override T GetProperty<T>(BindingContext context)
{
return context.GetInnerProperty<T>();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am currently the CTO of
Metaco, we are leveraging the Bitcoin Blockchain for delivering financial services.
I also developed a tool to make IaaS on Azure more easy to use
IaaS Management Studio.
If you want to contact me, go
this way