wcf - ravendb、城堡 IoC、Wcf 设施 - 文档 session 生活方式

标签 wcf castle-windsor ravendb wcffacility

在 IIS 中托管的 Windsor ioc、wcf 设施设置下,raven doc session 和存储的推荐生活方式是什么?

我一直看到这个错误:

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

Ayende 的回应是:
文档存储的单例, session 的 transient /Web 请求。

关于wcf - ravendb、城堡 IoC、Wcf 设施 - 文档 session 生活方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5310397/

相关文章:

c# - RavenDB 自定义序列化器和反序列化器

python - pyravendb查询参数解析错误

caSTLe-windsor - 将依赖项注入(inject)静态类

arrays - Ravendb 数组相交

wpf - 使用 Windows Workflow Foundation(WF) 作为表示规则引擎是否明智?

c# - WPF 在异步等待模式中使用 MVVM 和 WCF

c# - WCF - 大文件上传 - (413) 请求实体太大

c# - 使用跨域 WCF 服务时 OPTIONS 方法被拒绝

c# - 为什么 CaSTLe Windsor 类型的工厂在使用不同参数创建时返回相同的实例

dependency-injection - 我正在为 .net 寻找一个简单但实​​用且强大的 IOC/DI 框架