Skip to content

Instantly share code, notes, and snippets.

@jonathascosta
Created May 13, 2011 18:43
Show Gist options
  • Save jonathascosta/971065 to your computer and use it in GitHub Desktop.
Save jonathascosta/971065 to your computer and use it in GitHub Desktop.
Instalador Windsor para objetos DAL
public class TestDaoInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
AllTypes.FromAssemblyNamed("YourProduct.DataAccess")
.BasedOn(typeof(IDao<,>))
.Configure(c => c.LifeStyle.Transient)
.WithService.Select((t, baseType) => t.GetInterfaces())
.BasedOn(typeof(IDao<>))
.Configure(c => c.LifeStyle.Transient)
.WithService.Select((t, baseType) => t.GetInterfaces())
.BasedOn(typeof(IDao))
.Configure(c => c.LifeStyle.Transient)
.WithService.Select((t, baseType) => t.GetInterfaces()));
container.Register(
AllTypes.FromAssemblyNamed("Framework.DataAccess")
.BasedOn(typeof(IDao<,>))
.Configure(c => c.LifeStyle.Transient)
.WithService.Base()
.BasedOn(typeof(IDao<>))
.Configure(c => c.LifeStyle.Transient)
.WithService.Base()
.BasedOn(typeof(IDao))
.Configure(c => c.LifeStyle.Transient)
.WithService.Base());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment