Kuzgunlaştırılmış doc oturumu için önerilen yaşam tarzı nedir ve IIS'de barındırılan bir windsor ioc, wcf tesis kurulumu altında depolanıyor mu? RavenSessionFactoryBuilderravendb, kale IoC, Wcf tesisi - doc oturumu liefstyle
edilir buradacontainer.Register(
Component
.For<IRavenSessionFactoryBuilder>()
.ImplementedBy<RavenSessionFactoryBuilder>()
.LifeStyle.Singleton
);
container.Register(
Component
.For<IDocumentSession>()
.UsingFactoryMethod(kernel =>
kernel.Resolve<IRavenSessionFactoryBuilder>()
.GetSessionFactory()
.CreateSession()
)
.LifeStyle.Transient
);
// This is the repository making use of the IDocumentSession
container.Register(
Component
.For<IDomainRepository>()
.ImplementedBy<DomainRepository>()
.LifeStyle.Transient
);
Ve:
public class RavenInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(
Component.For<IDocumentStore>().ImplementedBy<DocumentStore>()
.DependsOn(new { connectionStringName = "RavenConnectionString" })
.OnCreate(DoInitialisation)
.LifeStyle.Singleton,
Component.For<IDocumentSession>()
.UsingFactoryMethod(GetDocumentSesssion)
.LifeStyle.Transient
);
container.Register(Component.For<IEventSeriesRepository>().ImplementedBy<EventSeriesRepository>().LifeStyle.Transient);
container.Register(Component.For<IEventInstanceRepository>().ImplementedBy<EventInstanceRepository>().LifeStyle.Transient);
container.Register(
Component.For<IProductionCompanyRepository>().ImplementedBy<ProductionCompanyRepository>().LifeStyle.
Transient);
}
static IDocumentSession GetDocumentSesssion(IKernel kernel)
{
var store = kernel.Resolve<IDocumentStore>();
return store.OpenSession();
}
public static void DoInitialisation(IKernel kernel, IDocumentStore store)
{
store.Initialize();
IndexCreation.CreateIndexes(typeof(EventSeries_ByName).Assembly, store);
}
}