static IDocumentSession OpenSession(IContext ctx) { var request = ctx.GetInstance <IFubuRequest>(); string environmentId = request.Get <ContextInputModel>().EnvironmentId; var currentStore = ctx.GetInstance <IDocumentStore>(); return(RavenSession.OpenSession(environmentId, currentStore)); }
static IDocumentSession OpenSession(IContext ctx) { var bus = ctx.GetInstance <IBus>(); string environmentId = null; if (bus.CurrentMessageContext != null && bus.CurrentMessageContext.Headers.ContainsKey("EnvironmentId")) { environmentId = bus.CurrentMessageContext.Headers["EnvironmentId"]; } var store = ctx.GetInstance <IDocumentStore>(); return(RavenSession.OpenSession(environmentId, store)); }