Skip to content

Instantly share code, notes, and snippets.

@tommarien
Last active August 29, 2015 13:56
Show Gist options
  • Save tommarien/9079688 to your computer and use it in GitHub Desktop.
Save tommarien/9079688 to your computer and use it in GitHub Desktop.
var container = new WindsorContainer()
// opt-in for Lazy
container.Register(Component.For<ILazyComponentLoader>()
.ImplementedBy<LazyOfTComponentLoader>());
// Necessary session registration
// ...
// Bind lifestyle of to whom it is intercepting
container.Register(Component.For<AutoTxInterceptor>()
.LifestyleTransient());
// register all commandhandlers
container.Register(Classes.FromAssemblyContaining(typeof (NHibernateConfigurationBuilder))
.BasedOn(typeof (ICommandHandler<>))
.WithService.Base()
.Configure(c => { c.Interceptors<AutoTxInterceptor>(); })
.LifestyleTransient());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment