Manages access to RavenDB and open sessions to work with RavenDB.
Inheritance: DocumentStoreBase
		public void Can_load_entity()
		{
			var specialId = "SHA1-UdVhzPmv0o+wUez+Jirt0OFBcUY=";

			using (base.GetNewServer())
			{
				IDocumentStore documentStore = new DocumentStore
				{
					Url = "http://localhost:8080"
				}.Initialize();

				using(var store = documentStore)
				{
					store.Initialize();

					using (var session = store.OpenSession())
					{
						var entity = new Entity() { Id = specialId };
						session.Store(entity);
						session.SaveChanges();
					}

					using (var session = store.OpenSession())
					{
						var entity1 = session.Load<object>(specialId);
						Assert.NotNull(entity1);
					}
				}
			}
		}
		public void CanReplicateBetweenTwoMultiTenantDatabases()
		{
			using (var store = new DocumentStore
			                   	{
			                   		DefaultDatabase = "FailoverTest",
			                   		Url = store1.Url,
			                   		Conventions =
			                   			{
			                   				FailoverBehavior = FailoverBehavior.AllowReadsFromSecondariesAndWritesToSecondaries
			                   			}
			                   	})
			{
				store.Initialize();
				var replicationInformerForDatabase = store.GetReplicationInformerForDatabase(null);
				var databaseCommands = (ServerClient) store.DatabaseCommands;
				replicationInformerForDatabase.UpdateReplicationInformationIfNeeded(databaseCommands)
					.Wait();

				var replicationDestinations = replicationInformerForDatabase.ReplicationDestinationsUrls;
				
				Assert.NotEmpty(replicationDestinations);

				using (var session = store.OpenSession())
				{
					session.Store(new Item());
					session.SaveChanges();
				}

				var sanityCheck = store.DatabaseCommands.Head("items/1");
				Assert.NotNull(sanityCheck);

				WaitForDocument(store2.DatabaseCommands.ForDatabase("FailoverTest"), "items/1");
			}
		}
Esempio n. 3
0
 public static DocumentStore SpinUpNewDB()
 {
     DocumentStore documentStore = new DocumentStore { Url = "http://localhost:8080" };
     documentStore.DefaultDatabase = "TestDB" + DateTime.Now.Ticks;
     documentStore.Initialize();
     return documentStore;
 }
        public ConfigureStructureMap()
        {
            Scan(s =>
                     {
                         s.TheCallingAssembly();
                         s.WithDefaultConventions();
                         s.Convention<SettingsScanner>();
                         s.ConnectImplementationsToTypesClosing(typeof (ModelRule<>));
                     });

            For<ISettingsProvider>().Use<AppSettingsProvider>();
            SetAllProperties(s => s.Matching(p => p.Name.EndsWith("Settings")));

            ForSingletonOf<IDocumentStore>()
                .Use(ctx =>
                         {
                             var store = new DocumentStore
                                             {
                                                 ConnectionStringName = "RavenDb",
                                                 Conventions = {IdentityPartsSeparator = "-"}
                                             }.Initialize();
                             IndexCreation.CreateIndexes(typeof (ConfigureFubuMvc).Assembly, store);
                             return store;
                         });

            For<IDocumentSession>()
                .Use(ctx => ctx.GetInstance<IDocumentStore>().OpenSession());

            For<IPrincipalFactory>()
                .Use<FubuPrincipalFactory>();

            this.FubuValidation();

            For<IValidationSource>().Add<RuleSource>();
        }
		public void CanIndexOnRangeForNestedValuesForDictionaryAsPartOfDictionary()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize())
			{
				using (var s = store.OpenSession())
				{
					s.Store(new UserWithIDictionary
					{
						NestedItems = new Dictionary<string, NestedItem>
					    {
					        { "Color", new NestedItem{ Value=50 } }
					    }
					});
					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					Assert.DoesNotThrow(() => s.Advanced.LuceneQuery<UserWithIDictionary>()
					                          	.WhereEquals("NestedItems,Key", "Color")
					                          	.AndAlso()
					                          	.WhereGreaterThan("NestedItems,Value.Value", 10)
					                          	.ToArray());
				}
			}
		}
Esempio n. 6
0
        public void After_modification_will_get_value_from_server()
        {
            using (GetNewServer())
            using (var store = new DocumentStore { Url = "http://localhost:8080" }.Initialize())
            {
                using (var s = store.OpenSession())
                {
                    s.Store(new User { Name = "Ayende" });
                    s.SaveChanges();
                }

                using (var s = store.OpenSession())
                {
                    s.Load<User>("users/1");
                    s.SaveChanges();
                }

                using (var s = store.OpenSession())
                {
                    var user = s.Load<User>("users/1");
                    user.Name = "Rahien";
                    Assert.Equal(1, HttpJsonRequest.NumberOfCachedRequests);
                    s.SaveChanges();
                }

                using (var s = store.OpenSession())
                {
                    s.Load<User>("users/1");
                    Assert.Equal(1, HttpJsonRequest.NumberOfCachedRequests); // did NOT get from cache
                }
            }
        }
Esempio n. 7
0
        public void CanCreateDatabaseUsingExtensionMethod()
        {
            using (GetNewServer(8080))
            using (var store = new DocumentStore
            {
                Url = "http://localhost:8080"
            }.Initialize())
            {
                store.DatabaseCommands.EnsureDatabaseExists("Northwind");

                string userId;

                using (var s = store.OpenSession("Northwind"))
                {
                    var entity = new User
                    {
                        Name = "First Mutlti Tenant Bank",
                    };
                    s.Store(entity);
                    userId = entity.Id;
                    s.SaveChanges();
                }

                using (var s = store.OpenSession())
                {
                    Assert.Null(s.Load<User>(userId));
                }

                using (var s = store.OpenSession("Northwind"))
                {
                    Assert.NotNull(s.Load<User>(userId));
                }
            }
        }
Esempio n. 8
0
        public void CanQueryDefaultDatabaseQuickly()
        {
            using (GetNewServer(8080))
            using (var store = new DocumentStore
            {
                Url = "http://localhost:8080"
            }.Initialize())
            {
                store.DatabaseCommands.EnsureDatabaseExists("Northwind");

                using (var s = store.OpenSession("Northwind"))
                {
                    var entity = new User
                    {
                        Name = "Hello",
                    };
                    s.Store(entity);
                    s.SaveChanges();
                }

                var sp = Stopwatch.StartNew();
                using (var s = store.OpenSession())
                {
                    Assert.Empty(s.Query<User>().Where(x => x.Name == "Hello"));
                }
                Assert.True(TimeSpan.FromSeconds(5) > sp.Elapsed);
            }
        }
Esempio n. 9
0
        public RavenDbRegistry(string connectionStringName)
        {
            For<IDocumentStore>()
                .Singleton()
                .Use(x =>
                         {
                             var store = new DocumentStore
                                             {
                                                 ConnectionStringName = connectionStringName,
                                             };
                             store.Initialize();

                             // Index initialisation.
                             IndexCreation.CreateIndexes(typeof(RecentTags).Assembly, store);

                             return store;
                         }
                )
                .Named("RavenDB Document Store.");

            For<IDocumentSession>()
                .AlwaysUnique()
                .Use(x =>
                         {
                             var store = x.GetInstance<IDocumentStore>();
                             return store.OpenSession();
                         })
                .Named("RavenDB Session (aka. Unit of Work).");
        }
Esempio n. 10
0
        private static void InitialiseRaven()
        {
            Store = new DocumentStore {ConnectionStringName = "RavenDB"};
            Store.Initialize();

            IndexCreation.CreateIndexes(Assembly.GetCallingAssembly(), Store);
        }
Esempio n. 11
0
		static void Main()
		{
			using (var store = new DocumentStore { ConnectionStringName = "RavenDB" }.Initialize())
			{
				int start = 0;
				while (true)
				{
					using (var session = store.OpenSession())
					{
						var posts = session.Query<Post>()
							.OrderBy(x => x.CreatedAt)
							.Include(x => x.CommentsId)
							.Skip(start)
							.Take(128)
							.ToList();

						if (posts.Count == 0)
							break;

						foreach (var post in posts)
						{
							session.Load<PostComments>(post.CommentsId).Post = new PostComments.PostReference
							{
								Id = post.Id,
								PublishAt = post.PublishAt
							};
						}

						session.SaveChanges();
						start += posts.Count;
						Console.WriteLine("Migrated {0}", start);
					}
				}
			}
		}
Esempio n. 12
0
        public void Should_save_put_to_tenant_database_if_tenant_database_is_reloaded_in_the_middle_of_the_put_transaction()
        {
			using (var server = GetNewServer(runInMemory: false))
            using (var store = new DocumentStore
            {
                Url = "http://*****:*****@"~\Databases\Mine" } }, });

                var tx1 = new TransactionInformation { Id = Guid.NewGuid().ToString() };
                var tx2 = new TransactionInformation { Id = Guid.NewGuid().ToString() };

                var tenantDatabaseDocument = store.DatabaseCommands.Get("Raven/Databases/" + TenantName);
                server.Database.Put("Raven/Databases/mydb", null, tenantDatabaseDocument.DataAsJson, tenantDatabaseDocument.Metadata, tx1);

                var tenantDb = GetDocumentDatabaseForTenant(server, TenantName);
                tenantDb.Put("Foo/1", null, new RavenJObject { { "Test", "123" } }, new RavenJObject(), tx2);

				server.Database.PrepareTransaction(tx1.Id);
                server.Database.Commit(tx1.Id);

                tenantDb = GetDocumentDatabaseForTenant(server, TenantName);
				tenantDb.PrepareTransaction(tx2.Id);
                tenantDb.Commit(tx2.Id);

                var fooDoc = tenantDb.Get("Foo/1", new TransactionInformation { Id = Guid.NewGuid().ToString() });
                Assert.NotNull(fooDoc);
            }
        }
Esempio n. 13
0
        public void CanGetNotificationAboutDocumentDelete()
        {
            using (GetNewServer())
            using (var store = new DocumentStore
            {
                Url = "http://localhost:8079"
            }.Initialize())
            {
                var list = new BlockingCollection<DocumentChangeNotification>();
                var taskObservable = store.Changes();
                taskObservable.Task.Wait();
                var observableWithTask = taskObservable.ForDocument("items/1");
                observableWithTask.Task.Wait();
                observableWithTask
                    .Where(x => x.Type == DocumentChangeTypes.Delete)
                    .Subscribe(list.Add);

                using (var session = store.OpenSession())
                {
                    session.Store(new Item(), "items/1");
                    session.SaveChanges();
                }

                store.DatabaseCommands.Delete("items/1", null);

                DocumentChangeNotification DocumentChangeNotification;
                Assert.True(list.TryTake(out DocumentChangeNotification, TimeSpan.FromSeconds(2)));

                Assert.Equal("items/1", DocumentChangeNotification.Id);
                Assert.Equal(DocumentChangeNotification.Type, DocumentChangeTypes.Delete);

                ((RemoteDatabaseChanges) taskObservable).DisposeAsync().Wait();
            }
        }
Esempio n. 14
0
        public override async Task<OperationState> ExportData(SmugglerExportOptions<RavenConnectionStringOptions> exportOptions)
		{
            using (store = CreateStore(exportOptions.From))
            {
                return await base.ExportData(exportOptions);
            }
		}
		public void CanFailoverReplicationBetweenTwoMultiTenantDatabases()
		{
			using (var store = new DocumentStore
			                   	{
			                   		DefaultDatabase = "FailoverTest",
			                   		Url = store1.Url,
			                   		Conventions =
			                   			{
			                   				FailoverBehavior = FailoverBehavior.AllowReadsFromSecondariesAndWritesToSecondaries
			                   			}
			                   	})
			{
				store.Initialize();
				var replicationInformerForDatabase = store.GetReplicationInformerForDatabase(null);
				replicationInformerForDatabase.UpdateReplicationInformationIfNeeded((ServerClient) store.DatabaseCommands)
					.Wait();

				using (var session = store.OpenSession())
				{
					session.Store(new Item());
					session.SaveChanges();
				}

				WaitForDocument(store2.DatabaseCommands.ForDatabase("FailoverTest"), "items/1");

				servers[0].Dispose();

				using (var session = store.OpenSession())
				{
					var load = session.Load<Item>("items/1");
					Assert.NotNull(load);
				}
			}
		}
Esempio n. 16
0
        public void CanOverwriteIndex()
        {
            using (var server = GetNewServer(port, path))
            {
                var store = new DocumentStore { Url = "http://localhost:" + port };
                store.Initialize();

                store.DatabaseCommands.PutIndex("test",
                                                new IndexDefinition
                                                {
                                                    Map = "from doc in docs select new { doc.Name }"
                                                }, overwrite: true);

                store.DatabaseCommands.PutIndex("test",
                                                new IndexDefinition
                                                {
                                                    Map = "from doc in docs select new { doc.Name }"
                                                }, overwrite: true);

                store.DatabaseCommands.PutIndex("test",
                                                new IndexDefinition
                                                {
                                                    Map = "from doc in docs select new { doc.Email }"
                                                }, overwrite: true);

                store.DatabaseCommands.PutIndex("test",
                                                new IndexDefinition
                                                {
                                                    Map = "from doc in docs select new { doc.Email }"
                                                }, overwrite: true);
            }
        }
Esempio n. 17
0
		public void CanUseStats()
		{
			using (GetNewServer())
			using (var docStore = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var session = docStore.OpenSession())
				{
					session.Store(new User { Name = "Ayende" });
					session.Store(new User { Name = "Oren" });
					session.SaveChanges();
				}


				using (var session = docStore.OpenSession())
				{
					RavenQueryStatistics stats;
					session.Query<User>()
						.Customize(x=>x.WaitForNonStaleResults())
						.Statistics(out stats)
						.Lazily();

					session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();

					Assert.Equal(2, stats.TotalResults);
				}
			}
		}
Esempio n. 18
0
		public void CanAggressivelyCacheLoads()
		{
			using (var server = GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var session = store.OpenSession())
				{
					session.Store(new User());
					session.Store(new User());
					session.SaveChanges();
				}

				WaitForAllRequestsToComplete(server);
				server.Server.ResetNumberOfRequests();

				for (int i = 0; i < 5; i++)
				{
					using (var session = store.OpenSession())
					{
						using (session.Advanced.DocumentStore.AggressivelyCacheFor(TimeSpan.FromMinutes(5)))
						{
							session.Advanced.Lazily.Load<User>("users/1");
							session.Advanced.Lazily.Load<User>("users/2");

							session.Advanced.Eagerly.ExecuteAllPendingLazyOperations();
						 }
					}
				}

				WaitForAllRequestsToComplete(server);
				Assert.Equal(1, server.Server.NumberOfRequests);
			}
		}
Esempio n. 19
0
        void InitializeDocumentStore()
        {
            _documentStore = _configuration.CreateDocumentStore();

            var keyGenerator = new SequentialKeyGenerator(_documentStore);
            _documentStore.Conventions.DocumentKeyGenerator = (a,b,c) => string.Format("{0}/{1}", CollectionName, keyGenerator.NextFor<IEvent>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<long>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<int>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<string>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<Guid>());
            //_documentStore.Conventions.IdentityTypeConvertors.Add(new ConceptTypeConverter<short>());

            _documentStore.Conventions.CustomizeJsonSerializer = s =>
            {
                s.Converters.Add(new MethodInfoConverter());
                s.Converters.Add(new EventSourceVersionConverter());
                s.Converters.Add(new ConceptConverter());
            };
            
           var originalFindTypeTagNam =  _documentStore.Conventions.FindTypeTagName;
           _documentStore.Conventions.FindTypeTagName = t =>
           {
               if (t.HasInterface<IEvent>() || t == typeof(IEvent)) return CollectionName;
               return originalFindTypeTagNam(t);
           };

            _documentStore.RegisterListener(new EventMetaDataListener(_eventMigrationHierarchyManager));
        }
Esempio n. 20
0
		public Expiration()
		{
			path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(Versioning.Versioning)).CodeBase);
			path = Path.Combine(path, "TestDb").Substring(6);
			database::Raven.Database.Extensions.IOExtensions.DeleteDirectory("Data");
			ravenDbServer = new RavenDbServer(
				new database::Raven.Database.Config.RavenConfiguration
				{
					Port = 8079,
					RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
					DataDirectory = path,
					Catalog =
						{
							Catalogs =
								{
									new AssemblyCatalog(typeof (ExpirationReadTrigger).Assembly)
								}
						},
					Settings =
						{
							{"Raven/Expiration/DeleteFrequencySeconds", "1"}
						}
				});
			ExpirationReadTrigger.GetCurrentUtcDate = () => DateTime.UtcNow;
			documentStore = new DocumentStore
			{
				Url = "http://localhost:8079"
			};
			documentStore.Initialize();
		}
        protected void Application_Start() {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);


            Store = new DocumentStore() { ConnectionStringName = "Onboarding" };
            Store.Initialize();
            var builder = new ContainerBuilder();

            Store.Conventions.RegisterIdConvention<User>((dbname, commands, user) => "users/" + user.UserName);

            builder.Register(c => {
                var store = new DocumentStore {
                    ConnectionStringName = "Onboarding",
                    DefaultDatabase = "Onboarding"
                }.Initialize();

                return store;

            }).As<IDocumentStore>().SingleInstance();

            builder.Register(c => c.Resolve<IDocumentStore>().OpenAsyncSession()).As<IAsyncDocumentSession>().InstancePerLifetimeScope();

        }
Esempio n. 22
0
 public static IDocumentSession GetRavenDBConnection()
 {
     DocumentStore documentStore = new DocumentStore();
     documentStore.ConnectionStringName="RavenDB";
     documentStore.Initialize();
     return documentStore.OpenSession();
 }
		public void CanSaveAndLoadSameTimeLocal()
		{
			using(GetNewServer())
			using (var store = new DocumentStore{Url = "http://localhost:8079"}.Initialize())
			{
				using (var session = store.OpenSession())
				{
					var serviceExecutionLog = new ServiceExecutionLog
					{
						LastDateChecked = new DateTime(2010, 2, 17, 19, 06, 06, DateTimeKind.Local)
					};

					session.Store(serviceExecutionLog);

					session.SaveChanges();

				}

				using (var session = store.OpenSession())
				{
					var log = session.Load<ServiceExecutionLog>("ServiceExecutionLogs/1");
					Assert.Equal(new DateTime(2010, 2, 17, 19, 06, 06), log.LastDateChecked);
				}
			}
		}
Esempio n. 24
0
		public void CanGenerateComplexPaths()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8079" }.Initialize())
			{
				using (var s = store.OpenSession())
				{
					s.Store(new User { Name = "Ayende" });
					s.Store(new User
					{
						Name = "Rahien",
						Friends = new[]
						{
							new DenormalizedReference {Name = "Ayende", Id = "users/1"},
						}
					});

					s.SaveChanges();
				}

				using (var s = store.OpenSession())
				{
					var user = s.Include("Friends,Id").Load<User>("users/2");
					Assert.Equal(1, user.Friends.Length);
					foreach (var denormalizedReference in user.Friends)
					{
						s.Load<User>(denormalizedReference.Id);
					}

					Assert.Equal(1, s.Advanced.NumberOfRequests);
				}
			}
		}
Esempio n. 25
0
		public void AddEntity()
		{
            //Please use a normal running database and not the ones contained in the Base Class
			using (var store = new DocumentStore())
			{
				store.Conventions.FindIdentityPropertyNameFromEntityName = typeName => "ID";
				store.Conventions.FindIdentityProperty = prop => prop.Name == "ID";

				IDocumentSession session = store.OpenSession();

				var article = new Article
				{
					Title = "Article 1",
					SubTitle = "Article 1 subtitle",
					PublishDate = DateTime.UtcNow.Add(TimeSpan.FromDays(1))
				};
				session.Store(article);
				session.SaveChanges();

				Assert.True(article.ID > 0);

				var insertedArticle = session.Query<Article>().Where(
					a => a.ID.In(new int[] {article.ID}) && a.PublishDate > DateTime.UtcNow).FirstOrDefault();

				Assert.NotNull(insertedArticle);
			}
		}
Esempio n. 26
0
		public void CanTrackPosts()
		{
			using (GetNewServer())
			using (var store = new DocumentStore { Url = "http://localhost:8080" })
			{
				store.Initialize();
				// make the replication check here
				using (var session = store.OpenSession())
				{
					session.Load<User>("users/1");
				}

				Guid id;
				using (var session = store.OpenSession())
				{
					session.Store(new User());
					session.SaveChanges();

					id = session.Advanced.DatabaseCommands.ProfilingInformation.Id;
				}

				var profilingInformation = store.GetProfilingInformationFor(id);

				Assert.Equal(1, profilingInformation.Requests.Count);
			}
		}
Esempio n. 27
0
		public void check_illegal_connstrings()
		{
			using (var store = new DocumentStore())
			{
				Assert.Throws<System.ArgumentException>(() => store.ParseConnectionString(string.Empty));
			}
		}
Esempio n. 28
0
        protected override void OnStart(string[] args)
        {
            try
            {
                container = new Container(x => x.AddRegistry<DependencyRegistry>());
                var myDocumentStore = new DocumentStore { ConnectionStringName = "EpiFlowDB" };

                var busConfiguration = new BusConfiguration();
                busConfiguration.EndpointName("EpiFlow.Messages");
                busConfiguration.UseContainer<StructureMapBuilder>(c => c.ExistingContainer(container));
                busConfiguration.UseSerialization<JsonSerializer>();
                busConfiguration.UsePersistence<RavenDBPersistence>()
                    .UseDocumentStoreForSubscriptions(myDocumentStore)
                    .UseDocumentStoreForSagas(myDocumentStore)
                    .UseDocumentStoreForTimeouts(myDocumentStore);
                busConfiguration.UseTransport<RabbitMQTransport>();
                busConfiguration.DefineCriticalErrorAction(OnCriticalError);
                busConfiguration.Transactions().DisableDistributedTransactions();

                if (Environment.UserInteractive && Debugger.IsAttached)
                {
                    busConfiguration.EnableInstallers();
                }
                var startableBus = Bus.Create(busConfiguration);
                bus = startableBus.Start();
            }
            catch (Exception exception)
            {
                OnCriticalError("Failed to start the bus.", exception);
            }
        }
Esempio n. 29
0
        public void ProperlyHandleDataDirectoryWhichEndsWithSlash()
        {
            server1 = CreateServer(8079, "D1");

            store1 = new DocumentStore
            {
                DefaultDatabase = "Northwind",
                Url = "http://*****:*****@"~\D1\N" } }
                });

            store1.DatabaseCommands.ForDatabase("Northwind").Get("force/load/of/db");

            Assert.True(
                Directory.Exists(Path.Combine(server1.SystemDatabase.Configuration.DataDirectory,
                                              "N")));


        }
Esempio n. 30
0
        public void Sample()
        {
            using (var store = NewDocumentStore())
            {
                #region authentication_3

                store.DatabaseCommands.Put("Raven/ApiKeys/sample",
                                           null,
                                           RavenJObject.FromObject(new ApiKeyDefinition
                                               {
                                                   Name = "sample",
                                                   Secret = "ThisIsMySecret",
                                                   Enabled = true,
                                                   Databases = new List<DatabaseAccess>
                                                       {
                                                           new DatabaseAccess {TenantId = "*"},
                                                           new DatabaseAccess {TenantId = Constants.SystemDatabase},
                                                       }
                                               }), new RavenJObject());

                #endregion
            }

            #region authentication_4
            var documentStore = new DocumentStore
                {
                    ApiKey = "sample/ThisIsMySecret",
                    Url = "http://localhost:8080/"
                };

            #endregion
        }
Esempio n. 31
0
        public void SearchGroupsTest()
        {
            var documentStore = new Raven.Client.Document.DocumentStore {
                Url = "http://localhost:8080", DefaultDatabase = "TestDB"
            };

            documentStore.Initialize();


            ProductGroupper target    = new ProductGroupper(documentStore);
            string          searchStr = "Acer*";

            Dictionary <string, List <Product> > actual;

            actual = target.SearchStoreProductGroups(searchStr);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count == 2);
        }
Esempio n. 32
0
 public DocumentSession(DocumentStore documentStore, IDocumentStoreListener[] storeListeners, IDocumentDeleteListener[] deleteListeners)
     : base(documentStore, storeListeners, deleteListeners)
 {
     DatabaseCommands = documentStore.DatabaseCommands;
 }
Esempio n. 33
0
 public ReplicationBehavior(DocumentStore documentStore)
 {
     this.documentStore = documentStore;
 }