Routing_Service_POC-noexe.zip
Routing_Service_POC
POC
RoutingServicePOC
_ReSharper.RoutingServicePOC
BuildScriptCache
.crc
.version
9
6ecd42b4.dat
NamedArguments
.crc
.version
8
64bd7be7.dat
ProjectModel
ProjectModel.dat
Resources
.crc
.version
SymbolCache.bin
TagPrefixes
.crc
.version
5
5402198f.dat
TodoCache
.crc
.version
5
5402198f.dat
WebsiteFileReferences
.crc
.version
WordIndex
.crc
.version
1
3da9581c.dat
Client
bin
Debug
Client.vshost.exe.manifest
MessageLog.svclog
obj
x86
Debug
Properties
ClientCommonLib
obj
Debug
Properties
GlobalCommonLib
GlobalCommonLib.csproj.user
obj
Debug
Properties
RoutingServicePOC.5.1.ReSharper.user
RoutingServicePOC.suo
RoutingServicePOC
Filter
obj
Debug
CSAutoParameterize
original
transformed
Package
PackageTmp
RoutingService.svc
RoutingServicePOC.zip
TransformWebConfig
original
transformed
Properties
RoutingService.svc
RoutingServicePOC.csproj.user
ServiceA.Contract
obj
Debug
Properties
ServiceA
bin
Debug
ServiceA.vshost.exe.manifest
obj
x86
Debug
Properties
ServiceB.Contract
obj
Debug
Properties
ServiceB
bin
Debug
ServiceB.vshost.exe.manifest
obj
x86
Debug
Properties
ServiceCommonLib
obj
Debug
Properties
Routing_Service_POC.zip
library
ICSharpCode.SharpZipLib.dll
Ionic.Zip.dll
.crc
.version
5
6ecd42b4.dat
DecompilerCache
.crc
.version
1
64bd7be7.dat
PdbInfo
ProjectModel.dat
.crc
.version
SymbolCache.bin
.crc
.version
0
1
2
5402198f.dat
6
.crc
.version
5402198f.dat
7
.crc
.version
.crc
.version
3da9581c.dat
3
Client.exe
Client.pdb
Client.vshost.exe
Client.vshost.exe.manifest
ClientCommonLib.dll
ClientCommonLib.pdb
GlobalCommonLib.dll
GlobalCommonLib.pdb
MessageLog.svclog
ServiceA.Contract.dll
ServiceA.Contract.pdb
ServiceB.Contract.dll
ServiceB.Contract.pdb
Client.csprojResolveAssemblyReference.cache
Client.exe
Client.pdb
DesignTimeResolveAssemblyReferencesInput.cache
ResolveAssemblyReference.cache
TempPE
bin
Debug
ClientCommonLib.dll
ClientCommonLib.pdb
GlobalCommonLib.dll
GlobalCommonLib.pdb
Release
ClientCommonLib.csprojResolveAssemblyReference.cache
ClientCommonLib.dll
ClientCommonLib.pdb
DesignTimeResolveAssemblyReferencesInput.cache
ResolveAssemblyReference.cache
TempPE
bin
Debug
GlobalCommonLib.dll
GlobalCommonLib.pdb
ICSharpCode.SharpZipLib.dll
Ionic.Zip.dll
Release
GlobalCommonLib.csproj.user
DesignTimeResolveAssemblyReferencesInput.cache
GlobalCommonLib.csprojResolveAssemblyReference.cache
GlobalCommonLib.dll
GlobalCommonLib.pdb
ResolveAssemblyReference.cache
TempPE
RoutingServicePOC.5.1.ReSharper.user
RoutingServicePOC.suo
App_Data
bin
GlobalCommonLib.dll
GlobalCommonLib.pdb
ICSharpCode.SharpZipLib.dll
Ionic.Zip.dll
RoutingServicePOC.dll
RoutingServicePOC.pdb
Database
DesignTimeResolveAssemblyReferencesInput.cache
bin
GlobalCommonLib.dll
GlobalCommonLib.pdb
RoutingServicePOC.dll
RoutingServicePOC.pdb
RoutingService.svc
RoutingServicePOC.zip
ResolveAssemblyReference.cache
RoutingServicePOC.csprojResolveAssemblyReference.cache
RoutingServicePOC.dll
RoutingServicePOC.pdb
TempPE
RoutingService.svc
RoutingServicePOC.csproj.user
bin
Debug
ServiceA.Contract.dll
ServiceA.Contract.pdb
Release
DesignTimeResolveAssemblyReferencesInput.cache
ServiceA.Contract.dll
ServiceA.Contract.pdb
TempPE
GlobalCommonLib.dll
GlobalCommonLib.pdb
ServiceA.Contract.dll
ServiceA.Contract.pdb
ServiceA.exe
ServiceA.pdb
ServiceA.vshost.exe
ServiceA.vshost.exe.manifest
ServiceCommonLib.dll
ServiceCommonLib.pdb
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
ResolveAssemblyReference.cache
ServiceA.csprojResolveAssemblyReference.cache
ServiceA.exe
ServiceA.pdb
TempPE
bin
Debug
ServiceB.Contract.dll
ServiceB.Contract.pdb
Release
DesignTimeResolveAssemblyReferencesInput.cache
ServiceB.Contract.dll
ServiceB.Contract.pdb
TempPE
GlobalCommonLib.dll
GlobalCommonLib.pdb
ServiceB.Contract.dll
ServiceB.Contract.pdb
ServiceB.exe
ServiceB.pdb
ServiceB.vshost.exe
ServiceB.vshost.exe.manifest
ServiceCommonLib.dll
ServiceCommonLib.pdb
Release
DesignTimeResolveAssemblyReferencesInput.cache
ResolveAssemblyReference.cache
ServiceB.csprojResolveAssemblyReference.cache
ServiceB.exe
ServiceB.pdb
TempPE
bin
Debug
GlobalCommonLib.dll
GlobalCommonLib.pdb
ServiceCommonLib.dll
ServiceCommonLib.pdb
Release
DesignTimeResolveAssemblyReferencesInput.cache
ResolveAssemblyReference.cache
ServiceCommonLib.csprojResolveAssemblyReference.cache
ServiceCommonLib.dll
ServiceCommonLib.pdb
TempPE
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel.Channels;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Text;
using System.ServiceModel;
using GlobalCommonLib;
namespace ClientCommonLib
{
public class CentralSessionEndpointBehavior : IEndpointBehavior
{
public CentralSessionEndpointBehavior()
{
}
public CentralSessionEndpointBehavior(string user, string password)
{
this.User = user;
this.Password = password;
}
public void AddBindingParameters(ServiceEndpoint serviceEndpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
{ }
public void ApplyClientBehavior(ServiceEndpoint serviceEndpoint, System.ServiceModel.Dispatcher.ClientRuntime behavior)
{
//Add the inspector
behavior.MessageInspectors.Add(new CentralSessionClientMessageInspector(this.User, this.Password));
}
public void ApplyDispatchBehavior(ServiceEndpoint serviceEndpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
{ }
public void Validate(ServiceEndpoint serviceEndpoint)
{ }
public string User { get; set; }
public string Password { get; set; }
}
public class CentralSessionClientMessageInspector : BehaviorExtensionElement, IClientMessageInspector
{
public CentralSessionClientMessageInspector()
{
}
public CentralSessionClientMessageInspector(string user, string password)
{
this.User = user;
this.Password = password;
}
public static event EventHandler<CentralSessionDataEventArgs<System.ServiceModel.Channels.Message>> PreRequestingService;
private void InvokePreRequestingService(CentralSessionDataEventArgs<System.ServiceModel.Channels.Message> e)
{
EventHandler<CentralSessionDataEventArgs<System.ServiceModel.Channels.Message>> handler = PreRequestingService;
if (handler != null) handler(this, e);
}
public static event EventHandler<CentralSessionDataEventArgs<System.ServiceModel.Channels.Message>> PostRequestingService;
private void InvokePostRequestingService(CentralSessionDataEventArgs<System.ServiceModel.Channels.Message> e)
{
EventHandler<CentralSessionDataEventArgs<System.ServiceModel.Channels.Message>> handler = PostRequestingService;
if (handler != null) handler(this, e);
}
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string _user;
public string User
{
get { return _user; }
set { _user = value; }
}
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string _password;
public string Password
{
get { return _password; }
set { _password = value; }
}
public override Type BehaviorType
{
get { return typeof(CentralSessionEndpointBehavior); }
}
protected override object CreateBehavior()
{
return new CentralSessionEndpointBehavior();
}
#region IClientMessageInspector Members
public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
{
InvokePostRequestingService(new CentralSessionDataEventArgs<Message>(reply));
}
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
{
CredentialHelper.SetSessionData(_user, _password, ref request);
InvokePreRequestingService(new CentralSessionDataEventArgs<Message>(request));
return null;
}
#endregion
}
public class CentralSessionDataEventArgs<TData> : EventArgs where TData : class
{
readonly TData _data;
public CentralSessionDataEventArgs(TData data)
{
if (data == null)
{
throw new ArgumentNullException("data");
}
this._data = data;
}
public TData Data
{
get { return _data; }
}
public override string ToString()
{
return _data.ToString();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of use 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.