public EmbeddableDatabaseChanges(EmbeddableDocumentStore embeddableDocumentStore, Action onDispose, Func<string, Etag, string[], bool> tryResolveConflictByUsingRegisteredConflictListeners) { this.onDispose = onDispose; this.tryResolveConflictByUsingRegisteredConflictListeners = tryResolveConflictByUsingRegisteredConflictListeners; Task = new CompletedTask<IDatabaseChanges>(this); indexesObservable = new EmbeddableObservableWithTask<IndexChangeNotification>(); documentsObservable = new EmbeddableObservableWithTask<DocumentChangeNotification>(); bulkInsertObservable = new EmbeddableObservableWithTask<BulkInsertChangeNotification>(); replicationConflictsObservable = new EmbeddableObservableWithTask<ReplicationConflictNotification>(); embeddableDocumentStore.DocumentDatabase.TransportState.OnIndexChangeNotification += (o, notification) => enqueuedActions.Add(() => indexesObservable.Notify(o, notification)); embeddableDocumentStore.DocumentDatabase.TransportState.OnDocumentChangeNotification += (o, notification) => enqueuedActions.Add(() => documentsObservable.Notify(o, notification)); embeddableDocumentStore.DocumentDatabase.TransportState.OnReplicationConflictNotification += (o, notification) => enqueuedActions.Add(() => replicationConflictsObservable.Notify(o, notification)); embeddableDocumentStore.DocumentDatabase.TransportState.OnReplicationConflictNotification += TryResolveConflict; embeddableDocumentStore.DocumentDatabase.TransportState.OnBulkInsertChangeNotification += (o, notification) => enqueuedActions.Add(() => { bulkInsertObservable.Notify(o, notification); documentsObservable.Notify(o, notification); }); enqueuedTask = System.Threading.Tasks.Task.Factory.StartNew(() => { while (true) { var action = enqueuedActions.Take(); if (action == null) return; action(); } }); }
public static Configure EmbeddedRavenSubscriptionStorage(this Configure config) { var store = new EmbeddableDocumentStore { ResourceManagerId = DefaultResourceManagerId, DataDirectory = DefaultDataDirectory }; store.Initialize(); return RavenSubscriptionStorage(config, store, "Default"); }
public static Configure EmbeddedRavenPersistence(this Configure config) { var store = new EmbeddableDocumentStore { ResourceManagerId = RavenPersistenceConstants.DefaultResourceManagerId, DataDirectory = RavenPersistenceConstants.DefaultDataDirectory }; return RavenPersistence(config, store); }
public EmbeddableDatabaseChanges(EmbeddableDocumentStore embeddableDocumentStore, Action onDispose) { this.onDispose = onDispose; Task = new CompletedTask(); indexesObservable = new EmbeddableObserableWithTask<IndexChangeNotification>(); documentsObservable = new EmbeddableObserableWithTask<DocumentChangeNotification>(); embeddableDocumentStore.DocumentDatabase.TransportState.OnIndexChangeNotification += indexesObservable.Notify; embeddableDocumentStore.DocumentDatabase.TransportState.OnDocumentChangeNotification += documentsObservable.Notify; }
public void Setup() { var store = new EmbeddableDocumentStore { RunInMemory = true, DataDirectory = Guid.NewGuid().ToString() }; store.Initialize(); entity = new TestSaga(); entity.Id = Guid.NewGuid(); SetupEntity(entity); var persister = new RavenSagaPersister { Store = store }; persister.Save(entity); savedEntity = persister.Get<TestSaga>(entity.Id); }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object" /> class. /// </summary> public RavenDbTestBase() { this.documentStore = new EmbeddableDocumentStore { RunInMemory = true }; this.documentStore.Initialize(); this.documentStore.RegisterListener(new NoStaleQueriesListener()); Indexes.UpdateDatabaseIndexes(this.documentStore); IndexCreation.CreateIndexes(typeof(PostTrackbacksCreationDateIndex).Assembly, this.documentStore); AutoMapperConfiguration.Configure(); }
public void Should_delete_the_saga() { var store = new EmbeddableDocumentStore { RunInMemory = true, DataDirectory = Guid.NewGuid().ToString() }; store.Initialize(); var saga = new TestSaga {Id = Guid.NewGuid()}; var persister = new RavenSagaPersister { Store = store }; persister.Save(saga); Assert.NotNull(persister.Get<TestSaga>(saga.Id)); persister.Complete(saga); Assert.Null(persister.Get<TestSaga>(saga.Id)); }
public RevisionDocumentDatabaseTests() { _documentStore = new EmbeddableDocumentStore { RunInMemory = true, }; _documentStore.Initialize(); _documentStore.DocumentDatabase.PutTriggers.Add(new RevisionDocumentPutTrigger { Database = _documentStore.DocumentDatabase }); _documentStore.DocumentDatabase.ReadTriggers.Add(new HideRevisionDocumentsFromIndexingReadTrigger { Database = _documentStore.DocumentDatabase }); }
public EmbeddableDatabaseChanges(EmbeddableDocumentStore embeddableDocumentStore, Action onDispose) { this.onDispose = onDispose; Task = new CompletedTask<IDatabaseChanges>(this); indexesObservable = new EmbeddableObservableWithTask<IndexChangeNotification>(); documentsObservable = new EmbeddableObservableWithTask<DocumentChangeNotification>(); embeddableDocumentStore.DocumentDatabase.TransportState.OnIndexChangeNotification += (o, notification) => enqueuedActions.Add(() => indexesObservable.Notify(o, notification)); embeddableDocumentStore.DocumentDatabase.TransportState.OnDocumentChangeNotification += (o, notification) => enqueuedActions.Add(() => documentsObservable.Notify(o, notification)); enqueuedTask = System.Threading.Tasks.Task.Factory.StartNew(() => { while (true) { var action = enqueuedActions.Take(); if (action == null) return; action(); } }); }
public EmbeddableDocumentStore NewDocumentStore( bool runInMemory = true, string requestedStorage = null, ComposablePartCatalog catalog = null, bool deleteDirectory = true, bool deleteDirectoryOnDispose = true, bool enableAuthentication = false) { path = Path.GetDirectoryName(Assembly.GetAssembly(typeof(RavenTestBase)).CodeBase); if (path.StartsWith(@"file:\", StringComparison.InvariantCultureIgnoreCase)) { path = path.Substring(6); } path = Path.Combine(path, Path.GetFileName(Path.GetDirectoryName(DataDir))); var storageType = GetDefaultStorageType(requestedStorage); var documentStore = new EmbeddableDocumentStore { Configuration = { DefaultStorageTypeName = storageType, DataDirectory = path, RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true, RunInMemory = storageType.Equals("esent", StringComparison.OrdinalIgnoreCase) == false && runInMemory, Port = 8079 } }; if (catalog != null) { documentStore.Configuration.Catalog.Catalogs.Add(catalog); } try { ModifyStore(documentStore); ModifyConfiguration(documentStore.Configuration); if (deleteDirectory) { IOExtensions.DeleteDirectory(path); } documentStore.Initialize(); if (enableAuthentication) { EnableAuthentication(documentStore.DocumentDatabase); ModifyConfiguration(documentStore.Configuration); } CreateDefaultIndexes(documentStore); if (deleteDirectoryOnDispose) { documentStore.Disposed += ClearDatabaseDirectory; } return(documentStore); } catch { // We must dispose of this object in exceptional cases, otherwise this test will break all the following tests. documentStore.Dispose(); throw; } finally { stores.Add(documentStore); } }
public WriteConflicts() { store = NewDocumentStore(requestedStorage: "esent"); db = store.SystemDatabase; }
public GeneralStorage() { store = NewDocumentStore(); db = store.SystemDatabase; }
public void write_then_read_answer_with_votes() { using (EmbeddableDocumentStore documentStore = NewDocumentStore()) { documentStore.Conventions.FindFullDocumentKeyFromNonStringIdentifier = (id, type, allowNull) => id.ToString(); new Answers_ByAnswerEntity2().Execute(documentStore); Guid questionId = Guid.NewGuid(); Guid answerId = Guid.NewGuid(); using (IDocumentSession session = documentStore.OpenSession()) { var user = new User { Id = @"user\222", DisplayName = "John Doe" }; session.Store(user); var question = new Question2 { Id = questionId, Title = "How to do this in RavenDb?", Content = "I'm trying to find how to model documents for better DDD support.", UserId = @"user\222" }; session.Store(question); var answer = new AnswerEntity2 { Id = answerId, Question = question, Content = "This is doable", UserId = user.Id }; answer.Votes = new[] { new AnswerVoteEntity2 { Id = Guid.NewGuid(), QuestionId = questionId, Answer = answer, Delta = 2 } }; session.Store(new Answer2 { Id = answerId, UserId = user.Id, QuestionId = question.Id, Content = "This is doable", Votes = new[] { new AnswerVote2 { Id = Guid.NewGuid(), QuestionId = questionId, AnswerId = answerId, Delta = 2 } } }); session.SaveChanges(); } using (IDocumentSession session = documentStore.OpenSession()) { AnswerEntity2 answerInfo = session.Query <Answer2, Answers_ByAnswerEntity2>() .Customize(x => x.WaitForNonStaleResultsAsOfNow()) .Where(x => x.Id == answerId) .As <AnswerEntity2>() .SingleOrDefault(); Assert.NotNull(answerInfo); Assert.NotNull(answerInfo.Votes); Assert.True(answerInfo.Votes.Length == 1); Assert.True(answerInfo.Votes[0].QuestionId == questionId); Assert.NotNull(answerInfo.Votes[0].Answer); Assert.True(answerInfo.Votes[0].Answer.Id == answerId); } } }
public RavenDB_2974() { store = NewDocumentStore(catalog: (new TypeCatalog(typeof(SecureIndexesQueryListener)))); new CompanyIndex().Execute(store); }
protected static void EnsureDtcIsSupported(EmbeddableDocumentStore documentStore) { EnsureDtcIsSupported(documentStore.SystemDatabase); }
public static Task <IStartableEndpoint> Create(Settings.Settings settings, TransportCustomization transportCustomization, TransportSettings transportSettings, LoggingSettings loggingSettings, IContainer container, EmbeddableDocumentStore documentStore, EndpointConfiguration configuration, bool isRunningAcceptanceTests) { var endpointName = settings.ServiceName; if (configuration == null) { configuration = new EndpointConfiguration(endpointName); var assemblyScanner = configuration.AssemblyScanner(); assemblyScanner.ExcludeAssemblies("ServiceControl.Plugin"); } // HACK: Yes I know, I am hacking it to pass it to RavenBootstrapper! configuration.GetSettings().Set(documentStore); configuration.GetSettings().Set("ServiceControl.Settings", settings); transportCustomization.CustomizeServiceControlEndpoint(configuration, transportSettings); configuration.GetSettings().Set(loggingSettings); configuration.SetDiagnosticsPath(loggingSettings.LogPath); // Disable Auditing for the service control endpoint configuration.DisableFeature <Audit>(); configuration.DisableFeature <AutoSubscribe>(); configuration.DisableFeature <TimeoutManager>(); configuration.DisableFeature <Outbox>(); var recoverability = configuration.Recoverability(); recoverability.Immediate(c => c.NumberOfRetries(3)); recoverability.Delayed(c => c.NumberOfRetries(0)); configuration.SendFailedMessagesTo($"{endpointName}.Errors"); configuration.UseSerialization <NewtonsoftSerializer>(); configuration.LimitMessageProcessingConcurrencyTo(settings.MaximumConcurrencyLevel); configuration.Conventions().DefiningEventsAs(t => typeof(IEvent).IsAssignableFrom(t) || IsExternalContract(t)); if (!isRunningAcceptanceTests) { configuration.EnableFeature <InternalCustomChecks>(); } #pragma warning disable CS0618 // Type or member is obsolete configuration.UseContainer <AutofacBuilder>(c => c.ExistingLifetimeScope(container)); #pragma warning restore CS0618 // Type or member is obsolete configuration.DefineCriticalErrorAction(CriticalErrorCustomCheck.OnCriticalError); if (Environment.UserInteractive && Debugger.IsAttached) { configuration.EnableInstallers(); } return(Endpoint.Create(configuration)); }
public DocumentStoreEmbeddedTests() { documentStore = NewDocumentStore(requestedStorage: "esent"); }
public void StartRaven(EmbeddableDocumentStore documentStore, Settings settings, bool maintenanceMode) { Settings = settings; Directory.CreateDirectory(settings.DbPath); documentStore.Listeners.RegisterListener(new SubscriptionsLegacyAddressConverter()); if (settings.RunInMemory) { documentStore.RunInMemory = true; } else { documentStore.DataDirectory = settings.DbPath; documentStore.Configuration.CompiledIndexCacheDirectory = settings.DbPath; } documentStore.UseEmbeddedHttpServer = maintenanceMode || settings.ExposeRavenDB; documentStore.EnlistInDistributedTransactions = false; var localRavenLicense = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "RavenLicense.xml"); if (File.Exists(localRavenLicense)) { Logger.InfoFormat("Loading RavenDB license found from {0}", localRavenLicense); documentStore.Configuration.Settings["Raven/License"] = NonBlockingReader.ReadAllTextWithoutLocking(localRavenLicense); } else { Logger.InfoFormat("Loading Embedded RavenDB license"); documentStore.Configuration.Settings["Raven/License"] = ReadLicense(); } //This is affects only remote access to the database in maintenace mode and enables access without authentication documentStore.Configuration.Settings["Raven/AnonymousAccess"] = "Admin"; documentStore.Configuration.Settings["Raven/Licensing/AllowAdminAnonymousAccessForCommercialUse"] = "true"; if (Settings.RunCleanupBundle) { documentStore.Configuration.Settings.Add("Raven/ActiveBundles", "CustomDocumentExpiration"); } documentStore.Configuration.DisableClusterDiscovery = true; documentStore.Configuration.ResetIndexOnUncleanShutdown = true; documentStore.Configuration.Port = settings.DatabaseMaintenancePort; documentStore.Configuration.HostName = settings.Hostname == "*" || settings.Hostname == "+" ? "localhost" : settings.Hostname; documentStore.Conventions.SaveEnumsAsIntegers = true; documentStore.Configuration.Catalog.Catalogs.Add(new AssemblyCatalog(GetType().Assembly)); documentStore.Initialize(); Logger.Info("Index creation started"); IndexCreation.CreateIndexes(typeof(RavenBootstrapper).Assembly, documentStore); IndexCreation.CreateIndexes(typeof(SagaAudit.SagaSnapshot).Assembly, documentStore); PurgeKnownEndpointsWithTemporaryIdsThatAreDuplicate(documentStore); }
private void InsertData(EmbeddableDocumentStore store) { using (var session = store.OpenSession()) { // Create Facet for wod session.Store(new FacetSetup { Id = "Facets/WodFacets", Facets = new List <Facet> { new Facet <WodsProjection> { Name = o => o.BenchmarkType }, new Facet <WodsProjection> { Name = o => o.WodType }, new Facet <WodsProjection> { Name = o => o.ExerciseList } } }); // Create Wod's #region ANGIE // Wodinfo var angie = new WodBase { Name = "Angie", Description = "Complete all reps of each exercise before moving to the next.", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises angie.ExerciseList.Add("Pull-ups"); angie.ExerciseList.Add("Push-ups"); angie.ExerciseList.Add("Sit-ups"); angie.ExerciseList.Add("Air Squat"); // Save wod session.Store(angie, "WodBases/1"); #endregion #region BARBARA // Wodinfo var barbara = new WodBase { Name = "Barbara", Description = "Time each round. Rest precisely three minutes between each round.", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises barbara.ExerciseList.Add("Pull-ups"); barbara.ExerciseList.Add("Push-ups"); barbara.ExerciseList.Add("Sit-ups"); barbara.ExerciseList.Add("Air Squat"); barbara.ExerciseList.Add("RestPeriod"); // Save wod session.Store(barbara, "WodBases/2"); #endregion #region CHELSEA // Wodinfo var chelsea = new WodBase { Name = "Chelsea", Description = "Set up before a clock, and every minute on the minute perform 5 pull-ups, " + "10 push-ups, and 15 squats. Can you continue for thirty minutes? Twenty minutes? How about 10? " + "Post results to comments. If you fall behind the clock keep going for thirty minutes and see how many rounds you can complete. " + "If you've finished the workout before this time add +1 to each exercise, i.e., 6 pull-ups, 11 push-ups, and 16 squats each minute, " + "and see if you can go the full thirty minutes.", BenchmarkType = BenchmarkType.Girls, WodType = WodType.MinuteWod, }; // Add Round and Exercises chelsea.ExerciseList.Add("Pull-ups"); chelsea.ExerciseList.Add("Push-ups"); chelsea.ExerciseList.Add("Air Squat"); // Save wod session.Store(chelsea, "WodBases/3"); #endregion #region CINDY // Wodinfo var cindy = new WodBase { Name = "Cindy", BenchmarkType = BenchmarkType.Girls, WodType = WodType.AmrapWod, }; // Add Round and Exercises cindy.ExerciseList.Add("Pull-ups"); cindy.ExerciseList.Add("Push-ups"); cindy.ExerciseList.Add("Air Squat"); // Save wod session.Store(cindy, "WodBases/4"); #endregion #region DIANE // Wodinfo var diane = new WodBase { Name = "Diane", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises diane.ExerciseList.Add("Deadlift"); diane.ExerciseList.Add("Handstand Push-ups"); // Save wod session.Store(diane, "WodBases/5"); #endregion #region ELISABETH // Wodinfo var elisabeth = new WodBase { Name = "Elisabeth", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises elisabeth.ExerciseList.Add("Clean"); elisabeth.ExerciseList.Add("Ring Dips"); // Save wod session.Store(elisabeth, "WodBases/6"); #endregion #region FRAN // Wodinfo var fran = new WodBase { Name = "Fran", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises fran.ExerciseList.Add("Thrusters"); fran.ExerciseList.Add("Pull-ups"); // Save wod session.Store(fran, "WodBases/7"); #endregion #region GRACE // Wodinfo var grace = new WodBase { Name = "Grace", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises grace.ExerciseList.Add("Clean & Jerk"); // Save wod session.Store(grace, "WodBases/8"); #endregion #region HELEN // Wodinfo var helen = new WodBase { Name = "Helen", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises helen.ExerciseList.Add("Run 400 m"); helen.ExerciseList.Add("Kettlebell Swings"); helen.ExerciseList.Add("Pull-ups"); // Save wod session.Store(helen, "WodBases/9"); #endregion #region ISABEL // Wodinfo var isabel = new WodBase { Name = "Isabel", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises isabel.ExerciseList.Add("Snatch"); // Save wod session.Store(isabel, "WodBases/10"); #endregion #region JACKIE // Wodinfo var jackie = new WodBase { Name = "Jackie", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises jackie.ExerciseList.Add("Row 1000 m"); jackie.ExerciseList.Add("Thrusters"); jackie.ExerciseList.Add("Pull-ups"); // Save wod session.Store(jackie, "WodBases/11"); #endregion #region KAREN // Wodinfo var karen = new WodBase { Name = "Karen", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises karen.ExerciseList.Add("Wall-ball Shots"); // Save wod session.Store(karen, "WodBases/12"); #endregion #region LINDA // Wodinfo var linda = new WodBase { Name = "Linda", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises linda.ExerciseList.Add("Deadlift"); linda.ExerciseList.Add("Bench Press"); linda.ExerciseList.Add("Clean"); // Save wod session.Store(linda, "WodBases/13"); #endregion #region MARY // Wodinfo var mary = new WodBase { Name = "Mary", BenchmarkType = BenchmarkType.Girls, WodType = WodType.AmrapWod, }; // Add Round and Exercises mary.ExerciseList.Add("Handstand Push-ups"); mary.ExerciseList.Add("Pistols"); mary.ExerciseList.Add("Pull-ups"); // Save wod session.Store(mary, "WodBases/14"); #endregion #region NANCY // Wodinfo var nancy = new WodBase { Name = "Nancy", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises nancy.ExerciseList.Add("Run 400 m"); nancy.ExerciseList.Add("Overhead Squat"); // Save wod session.Store(nancy, "WodBases/15"); #endregion #region AMANDA // Wodinfo var amanda = new WodBase { Name = "Amanda", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises amanda.ExerciseList.Add("Muscle-ups"); amanda.ExerciseList.Add("Snatch"); // Save wod session.Store(amanda, "WodBases/16"); #endregion #region ANNIE // Wodinfo var annie = new WodBase { Name = "Annie", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises annie.ExerciseList.Add("Double-unders"); annie.ExerciseList.Add("Sit-ups"); // Save wod session.Store(annie, "WodBases/17"); #endregion #region EVA // Wodinfo var eva = new WodBase { Name = "Eva", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises eva.ExerciseList.Add("Run 800 m"); eva.ExerciseList.Add("Kettlebell Swings"); eva.ExerciseList.Add("Pull-ups"); // Save wod session.Store(eva, "WodBases/18"); #endregion #region KELLY // Wodinfo var kelly = new WodBase { Name = "Kelly", BenchmarkType = BenchmarkType.Girls, WodType = WodType.TimeWod }; // Add Round and Exercises kelly.ExerciseList.Add("Run 400 m"); kelly.ExerciseList.Add("Box Jump"); kelly.ExerciseList.Add("Wall-ball Shots"); // Save wod session.Store(kelly, "WodBases/19"); #endregion #region LYNNE // Wodinfo var lynne = new WodBase { Name = "Lynne", BenchmarkType = BenchmarkType.Girls, WodType = WodType.MaxWod }; // Add Round and Exercises lynne.ExerciseList.Add("Bench Press"); lynne.ExerciseList.Add("Pull-ups"); // Save wod session.Store(lynne, "WodBases/20"); #endregion #region NICOLE // Wodinfo var nicole = new WodBase { Name = "Nicole", Description = "As many rounds as possible in 20 minutes, Note number of pull-ups completed for each round.", BenchmarkType = BenchmarkType.Girls, WodType = WodType.MaxWod, }; // Add Round and Exercises nicole.ExerciseList.Add("Run 400 m"); nicole.ExerciseList.Add("Pull-ups"); // Save wod session.Store(nicole, "WodBases/21"); #endregion session.SaveChanges(); } }
public void Embedded_store_test() { List <Car> cars; using ( var documentStore = new EmbeddableDocumentStore { Configuration = { RunInMemory = true, RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true } }) { documentStore.Initialize(); new CarIndex().Execute(documentStore); using (var session = documentStore.OpenSession()) { foreach (CarLot doc in Docs) { session.Store(doc); } session.SaveChanges(); } string targetLeasee = CarLeasees[0].Id; using (var session = documentStore.OpenSession()) { //Synchronize indexes session.Query <CarLot, CarIndex>().Customize(x => x.WaitForNonStaleResults(TimeSpan.FromMinutes(2))).FirstOrDefault(); var query = session.Query <CarLot, CarIndex>() .Where(carLot => carLot.Cars.Any(car => car.LeaseHistory.Any(leasee => leasee.Id == targetLeasee))) .Take(1024); var deserializer = session.Advanced.DocumentStore.Conventions.CreateSerializer(); var indexQuery = new IndexQuery { Query = query.ToString(), SkipTransformResults = true, PageSize = 1024, }; var queryResult = session.Advanced.DocumentStore.DatabaseCommands.Query(typeof(CarIndex).Name, indexQuery, new string[0]); var carLots = queryResult .Results .Select(x => deserializer.Deserialize <CarLot>(new RavenJTokenReader(x))) .ToArray() ; foreach (var carLot in carLots) { Assert.NotNull(carLot.Cars); Assert.NotEmpty(carLot.Cars); } cars = carLots .SelectMany(x => x.Cars) .Where(car => car.LeaseHistory.Any(leasee => leasee.Id == targetLeasee)) .ToList(); } } Assert.NotNull(cars); Assert.NotEmpty(cars); foreach (Car car in cars) { Assert.NotNull(car.LeaseHistory); Assert.NotEmpty(car.LeaseHistory); } }
public void Can_SortAndPageMultipleDates() { using (var store = new EmbeddableDocumentStore { RunInMemory = true }) { //Create an index store.Initialize(); store.DatabaseCommands.PutIndex("TestItemsIndex", new Raven.Abstractions.Indexing.IndexDefinition { Name = "TestItemsIndex", Map = @"from item in docs.TestItems from d in item.Dates.Select((Func<dynamic,dynamic>)(x => x.Date)).Distinct().DefaultIfEmpty() select new {Id = item.Id, Name = item.Name, EventDate = d, Area = item.Area};", Stores = { { "EventDate", FieldStorage.No } } }, true); //Insert some events at random dates var size = 50; using (var session = store.OpenSession()) { for (int i = 0; i < size; i++) { var r = new System.Random(); session.Store(new TestItem() { Id = "testitems/" + 1000 + i, Name = "Event Number " + (1000 + i), Area = r.Next(1, 3), Dates = null }); } } using (var session = store.OpenSession()) { for (int i = 1; i <= size; i++) { var r = new System.Random(i); var dates = new List <DateTime>(); for (var j = 0; j < 5; j++) { dates.Add(new DateTime(2012, r.Next(1, 12), r.Next(1, 28))); } session.Store(new TestItem() { Id = "testitems/" + i, Name = "Event Number " + i, Area = r.Next(1, 3), Dates = dates.Select(x => new EventDate() { Date = x }).ToArray() }); } session.SaveChanges(); } //Get all results RavenQueryStatistics stats; List <TestItem> result = null; using (var session = store.OpenSession()) { result = session.Advanced.LuceneQuery <TestItem>("TestItemsIndex") .Statistics(out stats) .WaitForNonStaleResults() .WhereBetweenOrEqual("EventDate", DateTime.Parse("2012-02-01"), DateTime.Parse("2012-09-01")) .AndAlso() .WhereEquals("Area", 2) .OrderBy("EventDate") .Take(1000) .ToList(); } //Get all results, paged List <TestItem> paged = new List <TestItem>(); RavenQueryStatistics stats2; int sum = result.Count; int skip = 0; var take = 10; for (int i = 0; i < sum; i += take) { using (var session = store.OpenSession()) { var r = session.Advanced.LuceneQuery <TestItem>("TestItemsIndex") .Statistics(out stats2) .WhereBetweenOrEqual("EventDate", DateTime.Parse("2012-02-01"), DateTime.Parse("2012-09-01")) .AndAlso() .WhereEquals("Area", 2) .OrderBy("EventDate") .Skip(paged.Count) .Take(take) .ToList(); skip += stats2.SkippedResults; paged.AddRange(r); } } Assert.Equal(result.Select(x => x.Id), paged.Select(x => x.Id)); } }
public static Task <IStartableEndpoint> Create(Settings.Settings settings, TransportCustomization transportCustomization, TransportSettings transportSettings, LoggingSettings loggingSettings, IContainer container, Action <ICriticalErrorContext> onCriticalError, EmbeddableDocumentStore documentStore, EndpointConfiguration configuration, bool isRunningAcceptanceTests) { var endpointName = settings.ServiceName; if (configuration == null) { configuration = new EndpointConfiguration(endpointName); var assemblyScanner = configuration.AssemblyScanner(); assemblyScanner.ExcludeAssemblies("ServiceControl.Plugin"); } configuration.Pipeline.Register(typeof(FullTypeNameOnlyBehavior), "Remove asm qualified name from the message type header"); // HACK: Yes I know, I am hacking it to pass it to RavenBootstrapper! configuration.GetSettings().Set(documentStore); configuration.GetSettings().Set("ServiceControl.Settings", settings); configuration.SendOnly(); transportCustomization.CustomizeSendOnlyEndpoint(configuration, transportSettings); //DisablePublishing API is available only on TransportExtensions for transports that implement IMessageDrivenPubSub so we need to set settings directly configuration.GetSettings().Set("NServiceBus.PublishSubscribe.EnablePublishing", false); var routing = new RoutingSettings(configuration.GetSettings()); routing.RouteToEndpoint(typeof(RegisterNewEndpoint), settings.ServiceControlQueueAddress); routing.RouteToEndpoint(typeof(MarkMessageFailureResolvedByRetry), settings.ServiceControlQueueAddress); configuration.GetSettings().Set(loggingSettings); configuration.SetDiagnosticsPath(loggingSettings.LogPath); // sagas are not auto-disabled for send-only endpoints configuration.DisableFeature <Sagas>(); configuration.UseSerialization <NewtonsoftSerializer>(); configuration.Conventions().DefiningEventsAs(t => typeof(IEvent).IsAssignableFrom(t) || IsExternalContract(t)); if (!isRunningAcceptanceTests) { configuration.ReportCustomChecksTo(settings.ServiceControlQueueAddress); } #pragma warning disable CS0618 // Type or member is obsolete configuration.UseContainer <AutofacBuilder>(c => c.ExistingLifetimeScope(container)); #pragma warning restore CS0618 // Type or member is obsolete configuration.DefineCriticalErrorAction(criticalErrorContext => { onCriticalError(criticalErrorContext); return(Task.FromResult(0)); }); if (Environment.UserInteractive && Debugger.IsAttached) { configuration.EnableInstallers(); } return(Endpoint.Create(configuration)); }
public void Cleanup() { _documentStore.Dispose(); _documentStore = null; }
static void Main(string[] args) { using (var store = new EmbeddableDocumentStore { UseEmbeddedHttpServer = true, Configuration = { RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true, RunInMemory = true, }, }) { store.Configuration.Catalog.Catalogs.Add(new AssemblyCatalog(typeof(ElasticsearchReplicationTask).Assembly)); store.Configuration.Settings.Add("Raven/ActiveBundles", "ElasticsearchReplication"); // Enable the bundle store.Initialize(); var replicationConfigs = new List <ElasticsearchReplicationConfig> { new ElasticsearchReplicationConfig { Id = "Raven/ElasticsearchReplication/Configuration/OrdersAndLines", Name = "OrdersAndLines", ElasticsearchNodeUrls = new List <Uri> { new Uri(ElasticsearchUrl) }, IndexName = "ravendb-elasticsearch-replication-demo", RavenEntityName = "Orders", SqlReplicationTables = { new SqlReplicationTable { TableName = "Orders", DocumentKeyColumn = "_id" }, new SqlReplicationTable { TableName = "OrderLines", DocumentKeyColumn = "OrderId" }, }, Script = @" var orderData = { Id: documentId, OrderLinesCount: this.OrderLines.length, $timestamp: this.CreatedAt, CustomerName: this.CustomerName, TotalCost: 0 }; for (var i = 0; i < this.OrderLines.length; i++) { var line = this.OrderLines[i]; orderData.TotalCost += (line.UnitPrice * line.Quantity); replicateToOrderLines({ $timestamp: this.CreatedAt, OrderId: documentId, PurchasedAt: orderData.CreatedAt, Quantity: line.Quantity, UnitPrice: line.UnitPrice, ProductId: line.ProductId, ProductName: line.ProductName }); } replicateToOrders(orderData);" }, new ElasticsearchReplicationConfig { Id = "Raven/ElasticsearchReplication/Configuration/ShoppingCarts", Name = "ShoppingCarts", ElasticsearchNodeUrls = new List <Uri> { new Uri(ElasticsearchUrl) }, IndexName = "ravendb-elasticsearch-replication-demo", RavenEntityName = "ShoppingCarts", SqlReplicationTables = { new SqlReplicationTable { TableName = "ShoppingCarts", DocumentKeyColumn = "_id" }, }, Script = @" var data = { $timestamp: this.CreatedAt, IpAddress: this.IpAddress }; replicateToShoppingCarts(data);" } }; // Load the sample dashboard so we can push it to the cluster next var sampleDashboard = Helpers.GetEmbeddedJson(typeof(Program).Assembly, ".KibanaOverviewDashboard.json"); using (var session = store.OpenSession()) { foreach (var cfg in replicationConfigs) { // Sets up the bundle's default Elasticsearch mapping. We call this separately on every config // because potentially each config may replicate to a different Elasticsearch cluster cfg.SetupDefaultMapping(); // Add the sample Kibana dashboard cfg.AddKibanaDashboard("RavenDB-Orders-Overview", sampleDashboard); session.Store(cfg); } session.SaveChanges(); } // Simulate orders and shopping carts logging using different threads / clients timer = new Timer(state => { using (var session = store.OpenSession()) { for (int i = 0; i < GetRandom.Int(0, 5); i++) { session.Store(FakeDataGenerator.CreateAFakeOrder()); } session.SaveChanges(); } }, null, TimeSpan.Zero, TimeSpan.FromSeconds(5)); timer2 = new Timer(state => { using (var session = store.OpenSession()) { for (int i = 0; i < GetRandom.Int(0, 10); i++) { session.Store(FakeDataGenerator.CreateAFakeShoppingCart()); } session.SaveChanges(); } }, null, TimeSpan.Zero, TimeSpan.FromSeconds(2)); Console.WriteLine("Posting Orders randomly to an in-memory RavenDB instance"); Console.WriteLine("That instance is then replicating some of that data to an Elasticsearch instance on " + ElasticsearchUrl); Console.WriteLine("Run Kibana (available via Kibana.Host in the same solution as this Demo app) to view real-time analytics"); Console.WriteLine("Working in the background.. press any key to quit"); Console.ReadKey(); } }
protected virtual void CreateDefaultIndexes(EmbeddableDocumentStore documentStore) { new RavenDocumentsByEntityName().Execute(documentStore); }
public static async Task <BusInstance> CreateAndStart(Settings.Settings settings, TransportCustomization transportCustomization, TransportSettings transportSettings, LoggingSettings loggingSettings, IContainer container, EmbeddableDocumentStore documentStore, EndpointConfiguration configuration, bool isRunningAcceptanceTests) { var startableEndpoint = await Create(settings, transportCustomization, transportSettings, loggingSettings, container, documentStore, configuration, isRunningAcceptanceTests) .ConfigureAwait(false); var domainEvents = container.Resolve <IDomainEvents>(); var errorIngestion = container.Resolve <ErrorIngestionComponent>(); var endpointInstance = await startableEndpoint.Start().ConfigureAwait(false); var builder = new ContainerBuilder(); builder.RegisterInstance(endpointInstance).As <IMessageSession>(); builder.Update(container.ComponentRegistry); return(new BusInstance(endpointInstance, domainEvents, errorIngestion)); }
public static IEnumerable <TestCaseData> Build(RepositoryType[] includeType) { if (includeType.Contains(RepositoryType.InMemory)) { yield return(new TestCaseData(new InMemoryRepository <Contact, string>()).SetName("InMemoryRepository Test")); } if (includeType.Contains(RepositoryType.Xml)) { var xmlDataDirectoryPath = XmlDataDirectoryFactory.Build("Contact"); yield return (new TestCaseData(new XmlRepository <Contact, string>(xmlDataDirectoryPath)).SetName("XmlRepository Test")); } if (includeType.Contains(RepositoryType.Ef5) || includeType.Contains(RepositoryType.Ef)) { var dbPath = EfDataDirectoryFactory.Build(); Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0"); yield return (new TestCaseData(new EfRepository <Contact, string>(new TestObjectEntities("Data Source=" + dbPath))).SetName("EfRepository Test")); } if (includeType.Contains(RepositoryType.Dbo4)) { var dbPath = Db4oDataDirectoryFactory.Build("Contact"); yield return(new TestCaseData(new Db4oRepository <Contact, string>(dbPath)).SetName("Db4oRepository Test")); } if (includeType.Contains(RepositoryType.MongoDb)) { string connectionString = MongoDbConnectionStringFactory.Build("Contact"); if (MongoDbRepositoryManager.ServerIsRunning(connectionString)) { MongoDbRepositoryManager.DropDatabase(connectionString); // Pre-test cleanup yield return(new TestCaseData(new MongoDbRepository <Contact, string>(connectionString)).SetName("MongoDb Test")); } } if (includeType.Contains(RepositoryType.RavenDb)) { var documentStore = new EmbeddableDocumentStore { RunInMemory = true, Conventions = { DefaultQueryingConsistency = ConsistencyOptions.QueryYourWrites } }; yield return(new TestCaseData(new RavenDbRepository <Contact, string>(documentStore)).SetName("RavenDbRepository Test")); } if (includeType.Contains(RepositoryType.Cache)) { yield return(new TestCaseData(new CacheRepository <Contact, string>(CachePrefixFactory.Build())).SetName("CacheRepository Test")); } if (includeType.Contains(RepositoryType.CouchDb)) { if (CouchDbRepositoryManager.ServerIsRunning(CouchDbUrl.Host, CouchDbUrl.Port)) { var databaseName = CouchDbDatabaseNameFactory.Build("Contact"); CouchDbRepositoryManager.DropDatabase(CouchDbUrl.Host, CouchDbUrl.Port, databaseName); CouchDbRepositoryManager.CreateDatabase(CouchDbUrl.Host, CouchDbUrl.Port, databaseName); yield return(new TestCaseData(new CouchDbRepository <Contact>(CouchDbUrl.Host, CouchDbUrl.Port, databaseName)).SetName("CouchDbRepository Test")); } } }
public DeleteIndexes() { store = NewDocumentStore(); db = store.SystemDatabase; }
public PutTriggers() { store = NewDocumentStore(catalog: (new TypeCatalog(typeof(VetoCapitalNamesPutTrigger), typeof(AuditPutTrigger)))); db = store.DocumentDatabase; }
public void write_then_read_from_complex_entity_types_with_Guids_as_keys() { using (EmbeddableDocumentStore documentStore = NewDocumentStore()) { documentStore.Conventions.FindFullDocumentKeyFromNonStringIdentifier = (id, type, allowNull) => id.ToString(); new Answers_ByAnswerEntity2().Execute(documentStore); Guid questionId = Guid.NewGuid(); Guid answerId = Guid.NewGuid(); using (IDocumentSession session = documentStore.OpenSession()) { var user = new User { Id = @"user/222", DisplayName = "John Doe" }; session.Store(user); var question = new Question2 { Id = questionId, Title = "How to do this in RavenDb?", Content = "I'm trying to find how to model documents for better DDD support.", UserId = @"user/222" }; session.Store(question); var answer = new AnswerEntity2 { Id = answerId, Question = question, Content = "This is doable", UserId = user.Id }; //session.Store(new Answer2 //{ // Id = answer.Id, // UserId = answer.UserId, // QuestionId = answer.Question.Id, // Content = answer.Content //} session.Store(new Answer2 { Id = answerId, UserId = user.Id, QuestionId = question.Id, Content = "This is doable" }); session.SaveChanges(); } using (IDocumentSession session = documentStore.OpenSession()) { AnswerEntity2 answerInfo = session.Query <Answer2, Answers_ByAnswerEntity2>() .Customize(x => x.WaitForNonStaleResultsAsOfNow()) .Where(x => x.Id == answerId) .As <AnswerEntity2>() .SingleOrDefault(); Assert.NotNull(answerInfo); Assert.NotNull(answerInfo.Question); } } }
public void WillNotGetDuplicatedResults_UsingLinq() { using (EmbeddableDocumentStore store = NewDocumentStore()) { store.DatabaseCommands.PutIndex("GameEventCountZoneBySpecificCharacter", new IndexDefinitionBuilder <GameEvent, GameEventCount> { Map = docs => from doc in docs where doc.DataUploadId != null && doc.RealmName != null && doc.Region != null && doc.CharacterName != null && doc.Zone != null && doc.SubZone != null select new { doc.DataUploadId, doc.RealmName, doc.Region, doc.CharacterName, doc.Zone, Count = 1 }, Reduce = results => from result in results group result by new { result.DataUploadId, result.RealmName, result.Region, result.CharacterName, result.Zone } into g select new { g.Key.DataUploadId, g.Key.RealmName, g.Key.Region, g.Key.CharacterName, g.Key.Zone, Count = g.Sum(x => x.Count) } }); using (IDocumentSession documentSession = store.OpenSession()) { for (int i = 0; i < 5; i++) { documentSession.Store(new GameEvent { Id = (i + 1).ToString(), UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneOne" }); } for (int i = 6; i < 8; i++) { documentSession.Store(new GameEvent { Id = (i + 1).ToString(), UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneTwo" }); } for (int i = 9; i < 12; i++) { documentSession.Store(new GameEvent { Id = (i + 1).ToString(), UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneThree" }); } documentSession.SaveChanges(); dynamic[] darykalSumResults = documentSession.Advanced.DocumentQuery <dynamic>("GameEventCountZoneBySpecificCharacter") .Where("CharacterName:Darykal AND RealmName:Moonglade AND Region:SingleRegion AND DataUploadId:10 ") .WaitForNonStaleResults(TimeSpan.FromDays(1)) .ToArray(); Assert.Equal(3, darykalSumResults.Length); } } }
public void will_work_normally_when_querying_multip_times() { using (EmbeddableDocumentStore documentStore = NewDocumentStore()) { new Answers_ByAnswerEntity().Execute(documentStore); const string Content = "This is doable"; const string UserId = @"user\222"; const string answerId = @"answer\540"; using (IDocumentSession session = documentStore.OpenSession()) { var user = new User { Id = @"user\222", DisplayName = "John Doe" }; session.Store(user); var answer = new AnswerEntity { Id = answerId, Question = null, Content = "This is doable", UserId = user.Id }; session.Store(new Answer { Id = answer.Id, UserId = answer.UserId, QuestionId = "", Content = answer.Content }); session.SaveChanges(); } // Working using (IDocumentSession session = documentStore.OpenSession()) { AnswerEntity answerInfo = session.Query <Answer, Answers_ByAnswerEntity>() .Customize(x => x.WaitForNonStaleResultsAsOfNow()) .Where(x => x.UserId == UserId && x.Content == Content) .As <AnswerEntity>() .SingleOrDefault(); Assert.NotNull(answerInfo); AnswerEntity answerInfo2 = session.Query <Answer, Answers_ByAnswerEntity>() .Customize(x => x.WaitForNonStaleResultsAsOfNow()) .Where(x => x.UserId == UserId && x.Content == Content) .As <AnswerEntity>() .SingleOrDefault(); Assert.NotNull(answerInfo2); } // Failing using (IDocumentSession session = documentStore.OpenSession()) { AnswerEntity answerInfo = session.Query <Answer, Answers_ByAnswerEntity>() .Customize(x => x.WaitForNonStaleResultsAsOfNow()) .Where(x => x.UserId == UserId && x.Content == Content) .As <AnswerEntity>() .SingleOrDefault(); Assert.NotNull(answerInfo); } } }
protected override void ModifyStore(EmbeddableDocumentStore documentStore) { documentStore.Conventions.SaveEnumsAsIntegers = true; }
public DocumentStoreEmbeddedTests() { documentStore = NewDocumentStore(); }
public Simple() { store = NewDocumentStore(); db = store.DocumentDatabase; }
protected virtual void ModifyStore(EmbeddableDocumentStore documentStore) { }
public ParameterizedDynamicQuery() { store = NewDocumentStore(); db = store.DocumentDatabase; }
public void WillNotGetDuplicatedResults() { using (EmbeddableDocumentStore store = NewDocumentStore()) { store.DatabaseCommands.PutIndex("GameEventCountZoneBySpecificCharacter", new IndexDefinition { Map = @"from doc in docs where doc.DataUploadId != null && doc.RealmName != null && doc.Region != null && doc.CharacterName != null && doc.Zone != null && doc.SubZone != null select new { DataUploadId = doc.DataUploadId, RealmName = doc.RealmName, Region = doc.Region, CharacterName = doc.CharacterName, Zone = doc.Zone, Count = 1 };", Reduce = @"from result in results group result by new { DataUploadId = result.DataUploadId, RealmName = result.RealmName, Region = result.Region, CharacterName = result.CharacterName, Zone = result.Zone } into g select new { DataUploadId = g.Key.DataUploadId, RealmName = g.Key.RealmName, Region = g.Key.Region, CharacterName = g.Key.CharacterName, Zone = g.Key.Zone, Count = g.Sum(x => (int)x.Count) };" }); using (IDocumentSession documentSession = store.OpenSession()) { documentSession.Store(new GameEvent { Id = "1", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneOne" }); documentSession.Store(new GameEvent { Id = "2", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneOne" }); documentSession.Store(new GameEvent { Id = "3", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneOne" }); documentSession.Store(new GameEvent { Id = "4", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneOne" }); documentSession.Store(new GameEvent { Id = "5", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneOne" }); documentSession.Store(new GameEvent { Id = "6", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneTwo" }); documentSession.Store(new GameEvent { Id = "7", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneTwo" }); documentSession.Store(new GameEvent { Id = "8", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneThree" }); documentSession.Store(new GameEvent { Id = "9", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneThree" }); documentSession.Store(new GameEvent { Id = "10", UserId = "UserId1", Time = "232", ActionName = "Something", CharacterName = "Darykal", DataUploadId = "10", RealmName = "Moonglade", Region = "SingleRegion", SubZone = "SubzoneOne", Zone = "ZoneOne" }); documentSession.SaveChanges(); ZoneCountResult[] darykalSumResults = documentSession.Advanced.DocumentQuery <GameEvent>("GameEventCountZoneBySpecificCharacter") .Where("RealmName:Moonglade AND Region:SingleRegion AND DataUploadId:10 ") .SelectFields <ZoneCountResult>("Zone", "Count") .WaitForNonStaleResults(TimeSpan.FromDays(1)) .ToArray(); Assert.Equal(3, darykalSumResults.Length); } } }
public In() { store = NewDocumentStore(); new SearchableElements().Execute(store); }