5 wcf castle-windsor ravendb wcffacility
在IIS中托管的windsor ioc,wcf设施设置下,推荐的raven doc会话和商店的生活方式是什么?
我一直看到这个错误:
Error TempPathInUse (JET_errTempPathInUse, Temp path already used by another database instance)`
Run Code Online (Sandbox Code Playgroud)
这是我的设置:
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);
}
}
Run Code Online (Sandbox Code Playgroud)
Raven 论坛中也提出了关于生命周期的相同问题: https://groups.google.com/forum/#! topic/ravendb/wUgULf3eoCg
Ayende 的回应是:文档存储使用单例,会话使用瞬态/Web 请求。
| 归档时间: |
|
| 查看次数: |
922 次 |
| 最近记录: |