ravendb, castle IoC ,Wcf facility - doc session liefstyle:

313 views
Skip to first unread message

Wayne Douglas

unread,
Mar 15, 2011, 6:28:17 AM3/15/11
to ravendb

Hi

What's the recommended lifestyle for raven doc session and store under a windsor ioc, wcf facility setup hosted in IIS?
--
Cheers,

w://

Wayne Douglas

unread,
Mar 15, 2011, 6:44:00 AM3/15/11
to ravendb
the reason i ask is because i keep seeing this error:

Error TempPathInUse (JET_errTempPathInUse, Temp path already used by another database instance)


here is how i add the doc store and session to the ioc:


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);

       
}
   
}
--
Cheers,

w://

Ayende Rahien

unread,
Mar 15, 2011, 7:54:51 AM3/15/11
to rav...@googlegroups.com
Singleton for the Document Store, Trasient / Web Request for the session.

Ayende Rahien

unread,
Mar 15, 2011, 7:55:30 AM3/15/11
to rav...@googlegroups.com
Are you using the embedded version?

On Tue, Mar 15, 2011 at 12:44 PM, Wayne Douglas <codin...@googlemail.com> wrote:
the reason i ask is because i keep seeing this error:

Error TempPathInUse (JET_errTempPathInUse, Temp path already used by another database instance)


here is how i add the doc store and session to the ioc:


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 =
...

[Message clipped]  

Wayne Douglas

unread,
Mar 15, 2011, 8:04:54 AM3/15/11
to rav...@googlegroups.com, Ayende Rahien
hosted in IIS
--
Cheers,

w://

Wayne Douglas

unread,
Mar 15, 2011, 8:05:20 AM3/15/11
to rav...@googlegroups.com, Ayende Rahien
i am now using the latest drop on my server rather than locally and it seems fine...

--
Cheers,

w://

Ayende Rahien

unread,
Mar 15, 2011, 8:17:34 AM3/15/11
to rav...@googlegroups.com
Oh, yes, I remember this. That was fixed in the latest build
Reply all
Reply to author
Forward
0 new messages