public async Task <long> StoreDataAsNew(T[] data) { var sw = new Stopwatch(); sw.Start(); DeleteData(); await CreateDatabase(); //using (var instance = ConnectInstance(DatabaseName())) { using (var bulkInsert = instanceDefault.BulkInsert(DatabaseName())) { foreach (var id in data) { bulkInsert.Store(id, id.ID); } } var dbc = instanceDefault.DatabaseCommands.ForDatabase(DatabaseName()); var defIndex = new RavenDocumentsByEntityName(); defIndex.Execute(dbc, new DocumentConvention() { DefaultUseOptimisticConcurrency = true }); instanceDefault.ExecuteIndex(defIndex); } sw.Stop(); await Task.Delay(2000);//to can retrieve after return(sw.ElapsedMilliseconds); }
public override void Init(int flowCount, long flowRecordCount) { recordsCount = 0; bulkInsertSessions = new BulkInsertOperation[flowCount]; dataStore = new EmbeddableDocumentStore { DataDirectory = this.DataDirectory }; dataStore.Initialize(); IndexCreation.CreateIndexes(typeof(TickRecordIndex).Assembly, dataStore); for (int i = 0; i < flowCount; i++) { var session = dataStore.BulkInsert(); bulkInsertSessions[i] = session; } }
public static void ConfigureRaven(MvcApplication application) { var store = new EmbeddableDocumentStore { DataDirectory = "~/App_Data/Database", UseEmbeddedHttpServer = true }; store.Conventions.CustomizeJsonSerializer = x => x.Converters.Add(new GeoJsonConverter()); store.Initialize(); MvcApplication.DocumentStore = store; store.ExecuteIndex(new RestaurantIndex()); store.ExecuteTransformer(new RestaurantsTransformer()); var statistics = store.DatabaseCommands.GetStatistics(); if (statistics.CountOfDocuments < 5) { using (var bulkInsert = store.BulkInsert()) LoadRestaurants(application.Server.MapPath("~/App_Data/Restaurants.csv"), bulkInsert); } }
public void CanStoreDocumentWithNonStringIdPropertyAndDefaultValue() { using (var store = new EmbeddableDocumentStore { RunInMemory = true, Configuration = { RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true } }) { store.Configuration.Storage.Voron.AllowOn32Bits = true; store.Initialize(); using (var insert = store.BulkInsert()) { Assert.DoesNotThrow(() => insert.Store(new ExampleInt32())); Assert.DoesNotThrow(() => insert.Store(new ExampleInt64())); } } }