Пример #1
0
 public ViewStorage()
 {
     transactionalStorage = new TransactionalStorage(new RavenConfiguration
     {
         DataDirectory = "raven.db.test.esent",
         RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true
     }, () => { });
     transactionalStorage.Initialize();
 }
Пример #2
0
        public DocumentDatabase(RavenConfiguration configuration)
        {
            this.configuration = configuration;
            workContext = new WorkContext();
            TransactionalStorage = new TransactionalStorage(configuration.DataDirectory, workContext.NotifyAboutWork);
            bool newDb;
            try
            {
                newDb = TransactionalStorage.Initialize();
            }
            catch (Exception)
            {
                TransactionalStorage.Dispose();
                throw;
            }

            IndexDefinitionStorage = new IndexDefinitionStorage(configuration.DataDirectory);
            IndexStorage = new IndexStorage(configuration.DataDirectory, IndexDefinitionStorage);

            workContext.IndexStorage = IndexStorage;
            workContext.TransactionaStorage = TransactionalStorage;
            workContext.IndexDefinitionStorage = IndexDefinitionStorage;

            if (!newDb)
                return;

            if(configuration.ShouldCreateDefaultsWhenBuildingNewDatabaseFromScratch)
            {
                PutIndex("Raven/DocumentsByEntityName",
                         new IndexDefinition
                         {
                         	Map =
                         		@"
            from doc in docs
            where doc[""@metadata""][""Raven-Entity-Name""] != null
            select new { Tag = doc[""@metadata""][""Raven-Entity-Name""] };
            "
                         });
            }

            configuration.RaiseDatabaseCreatedFromScratch(this);
        }
Пример #3
0
		public DocumentDatabase(RavenConfiguration configuration)
		{
			Configuration = configuration;
			
			configuration.Container.SatisfyImportsOnce(this);

		    workContext = new WorkContext {IndexUpdateTriggers = IndexUpdateTriggers};

			TransactionalStorage = new TransactionalStorage(configuration, workContext.NotifyAboutWork);
			configuration.Container.SatisfyImportsOnce(TransactionalStorage);
			
            bool newDb;
			try
			{
				newDb = TransactionalStorage.Initialize();
			}
			catch (Exception)
			{
				TransactionalStorage.Dispose();
				throw;
			}

			IndexDefinitionStorage = new IndexDefinitionStorage(
                TransactionalStorage,
                configuration.DataDirectory, 
                configuration.Container.GetExportedValues<AbstractViewGenerator>());
			IndexStorage = new IndexStorage(IndexDefinitionStorage, configuration);

			workContext.IndexStorage = IndexStorage;
			workContext.TransactionaStorage = TransactionalStorage;
			workContext.IndexDefinitionStorage = IndexDefinitionStorage;


			InitializeTriggers();
			ExecuteStartupTasks();

			if (!newDb) 
				return;

			OnNewlyCreatedDatabase();
		}
Пример #4
0
 public ViewStorage()
 {
     transactionalStorage = new TransactionalStorage("raven.db.test.esent", () => { });
     transactionalStorage.Initialize();
 }