Created
December 20, 2011 19:58
-
-
Save serdarb/1503001 to your computer and use it in GitHub Desktop.
Bootstrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Bootstrapper | |
{ | |
public static IWindsorContainer Container { get; private set; } | |
public static void Initialize() | |
{ | |
Container = new WindsorContainer(); | |
Container.AddFacility<WcfFacility>(); | |
Container.Register( | |
AllTypes.FromAssemblyNamed("DogmaticWcf.Server.Services") | |
.Pick().If(type => type.GetInterfaces().Any(i => i.IsDefined(typeof(ServiceContractAttribute), true))) | |
.Configure(configurer => configurer | |
.Named(configurer.Implementation.Name) | |
.LifeStyle.PerWcfOperation() | |
.AsWcfService( | |
new DefaultServiceModel() | |
.AddEndpoints( | |
WcfEndpoint.BoundTo(new NetTcpBinding { PortSharingEnabled = true }).At(string.Format("net.tcp://localhost:6969/{0}", configurer.Implementation.Name)), | |
WcfEndpoint.BoundTo(new NetNamedPipeBinding()).At(string.Format("net.pipe://localhost/{0}", configurer.Implementation.Name))) | |
.PublishMetadata() | |
) | |
) | |
.WithService.Select( | |
(type, baseTypes) => type.GetInterfaces().Where(i => i.IsDefined(typeof(ServiceContractAttribute), true)).Select(x => x as Type) | |
) | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment