ravendb,城堡IoC,Wcf设施-Doc Session Liefstyle [英] ravendb, castle IoC ,Wcf facility - doc session liefstyle
本文介绍了ravendb,城堡IoC,Wcf设施-Doc Session Liefstyle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
乌鸦文档会话并存储在IIS中托管的Windsor IOC,wcf设施设置下的推荐生活方式是什么?
What's the recommended lifestyle for raven doc session and store under a windsor ioc, wcf facility setup hosted in IIS?
我一直看到此错误:
Error TempPathInUse (JET_errTempPathInUse, Temp path already used by another database instance)`
这是我的设置:
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);
}
}
推荐答案
在Raven论坛中也提出了有关生命周期的相同问题: https://groups.google.com/forum/#!topic/ravendb/wUgULf3eoCg
This same question about lifecycle was raised in the Raven forums: https://groups.google.com/forum/#!topic/ravendb/wUgULf3eoCg
Ayende的回应是: 用于文档存储的Singleton,用于会话的Transient/Web Request.
Ayende's response was: Singleton for the Document Store, Transient / Web Request for the session.
这篇关于ravendb,城堡IoC,Wcf设施-Doc Session Liefstyle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文