static Configure RavenPersistence(this Configure config, IDocumentStore store) { if (config == null) { throw new ArgumentNullException("config"); } if (store == null) { throw new ArgumentNullException("store"); } var conventions = new RavenConventions(); store.Conventions.FindTypeTagName = tagNameConvention ?? conventions.FindTypeTagName; store.Initialize(); config.Configurer.RegisterSingleton <IDocumentStore>(store); config.Configurer.ConfigureComponent <RavenSessionFactory>(DependencyLifecycle.SingleInstance); config.Configurer.ConfigureComponent <RavenUnitOfWork>(DependencyLifecycle.InstancePerCall); RavenDBInstaller.InstallEnabled = installRavenIfNeeded && ravenInstallEnabled; return(config); }
public virtual void Setup() { store = new EmbeddableDocumentStore { RunInMemory = true, DataDirectory = Guid.NewGuid().ToString() }; var conventions = new RavenConventions(); store.Conventions.FindTypeTagName = conventions.FindTypeTagName; store.Initialize(); }
public virtual void Setup() { store = new EmbeddableDocumentStore { RunInMemory = true, DataDirectory = Guid.NewGuid().ToString() }; //store = new DocumentStore // { // Url = "http://localhost:8080", // }; var conventions = new RavenConventions(); store.Conventions.FindTypeTagName = conventions.FindTypeTagName; store.Initialize(); }
static Configure RavenPersistence(this Configure config, IDocumentStore store) { if (config == null) { throw new ArgumentNullException("config"); } if (store == null) { throw new ArgumentNullException("store"); } var conventions = new RavenConventions(); store.Conventions.FindTypeTagName = tagNameConvention ?? conventions.FindTypeTagName; EnsureDatabaseExists((DocumentStore)store); store.Initialize(); var maxNumberOfRequestsPerSession = 100; var ravenMaxNumberOfRequestsPerSession = ConfigurationManager.AppSettings["NServiceBus/Persistence/RavenDB/MaxNumberOfRequestsPerSession"]; if (!String.IsNullOrEmpty(ravenMaxNumberOfRequestsPerSession)) { if (!Int32.TryParse(ravenMaxNumberOfRequestsPerSession, out maxNumberOfRequestsPerSession)) { throw new ConfigurationErrorsException(string.Format("Cannot configure RavenDB MaxNumberOfRequestsPerSession. Cannot convert value '{0}' in <appSettings> with key 'NServiceBus/Persistence/RavenDB/MaxNumberOfRequestsPerSession' to a numeric value.", ravenMaxNumberOfRequestsPerSession)); } } store.Conventions.MaxNumberOfRequestsPerSession = maxNumberOfRequestsPerSession; //We need to turn compression off to make us compatible with Raven616 store.JsonRequestFactory.DisableRequestCompression = !enableRequestCompression; config.Configurer.RegisterSingleton <IDocumentStore>(store); config.Configurer.ConfigureComponent <RavenSessionFactory>(DependencyLifecycle.SingleInstance); config.Configurer.ConfigureComponent <RavenUnitOfWork>(DependencyLifecycle.InstancePerCall); RavenDBInstaller.InstallEnabled = installRavenIfNeeded && ravenInstallEnabled; return(config); }
static Configure RavenPersistence(this Configure config, IDocumentStore store) { if (config == null) throw new ArgumentNullException("config"); if (store == null) throw new ArgumentNullException("store"); var conventions = new RavenConventions(); store.Conventions.FindTypeTagName = tagNameConvention ?? conventions.FindTypeTagName; store.Initialize(); config.Configurer.RegisterSingleton<IDocumentStore>(store); config.Configurer.ConfigureComponent<RavenSessionFactory>(DependencyLifecycle.InstancePerUnitOfWork); config.Configurer.ConfigureComponent<RavenUnitOfWork>(DependencyLifecycle.InstancePerUnitOfWork); RavenDBInstaller.InstallEnabled = installRavenIfNeeded && ravenInstallEnabled; return config; }
static Configure RavenPersistence(this Configure config, IDocumentStore store) { if (config == null) throw new ArgumentNullException("config"); if (store == null) throw new ArgumentNullException("store"); var conventions = new RavenConventions(); store.Conventions.FindTypeTagName = tagNameConvention ?? conventions.FindTypeTagName; store.Initialize(); var maxNumberOfRequestsPerSession = 100; var ravenMaxNumberOfRequestsPerSession = ConfigurationManager.AppSettings["NServiceBus/Persistence/RavenDB/MaxNumberOfRequestsPerSession"]; if (!String.IsNullOrEmpty(ravenMaxNumberOfRequestsPerSession)) { if(!Int32.TryParse(ravenMaxNumberOfRequestsPerSession, out maxNumberOfRequestsPerSession)) throw new ConfigurationErrorsException(string.Format("Cannot configure RavenDB MaxNumberOfRequestsPerSession. Cannot convert value '{0}' in <appSettings> with key 'NServiceBus/Persistence/RavenDB/MaxNumberOfRequestsPerSession' to a numeric value.", ravenMaxNumberOfRequestsPerSession)); } store.Conventions.MaxNumberOfRequestsPerSession = maxNumberOfRequestsPerSession; config.Configurer.RegisterSingleton<IDocumentStore>(store); config.Configurer.ConfigureComponent<RavenSessionFactory>(DependencyLifecycle.SingleInstance); config.Configurer.ConfigureComponent<RavenUnitOfWork>(DependencyLifecycle.InstancePerCall); RavenDBInstaller.InstallEnabled = installRavenIfNeeded && ravenInstallEnabled; return config; }