Exemplo n.º 1
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            options.CreatePatching();

            _options           = options;
            _connectionFactory = options.ConnectionFactory();

            _logger = options.Logger();

            Schema = new DocumentSchema(_options, _connectionFactory, _logger);

            _serializer = options.Serializer();

            var cleaner = new DocumentCleaner(_connectionFactory, Schema.As <DocumentSchema>());

            Advanced = new AdvancedOptions(cleaner, options, _serializer, Schema);

            Diagnostics = new Diagnostics(Schema);


            CreateDatabaseObjects();

            Transform = new DocumentTransforms(this, _connectionFactory);

            options.InitialData.Each(x => x.Populate(this));


            if (options.AutoCreateSchemaObjects != AutoCreate.None)
            {
                Schema.As <DocumentSchema>().RebuildSystemFunctions();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            options.ApplyConfiguration();
            options.CreatePatching();
            options.Validate();

            Options      = options;
            _logger      = options.Logger();
            Serializer   = options.Serializer();
            _retryPolicy = options.RetryPolicy();

            if (options.CreateDatabases != null)
            {
                IDatabaseGenerator databaseGenerator = new DatabaseGenerator();
                databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases);
            }

            Tenancy.Initialize();

            Schema = Tenancy.Schema;

            Storage.PostProcessConfiguration();

            Advanced = new AdvancedOptions(this);

            Diagnostics = new Diagnostics(this);

            Transform = new DocumentTransforms(this, Tenancy.Default);

            options.InitialData.Each(x => x.Populate(this));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            _options           = options;
            _connectionFactory = options.ConnectionFactory();
            _runner            = new ManagedConnection(_connectionFactory, CommandRunnerMode.ReadOnly);

            _logger = options.Logger();

            var creation = options.AutoCreateSchemaObjects
                ? (IDocumentSchemaCreation) new DevelopmentSchemaCreation(_connectionFactory, _logger)
                : new ProductionSchemaCreation();

            Schema = new DocumentSchema(_options, _connectionFactory, creation);

            Schema.Alter(options.Schema);

            _serializer = options.Serializer();

            var cleaner = new DocumentCleaner(_connectionFactory, Schema);

            Advanced = new AdvancedOptions(cleaner, options);

            Diagnostics = new Diagnostics(Schema, new MartenQueryExecutor(_runner, Schema, _serializer, _parser, new NulloIdentityMap(_serializer)));

            EventStore = new EventStoreAdmin(_connectionFactory, _options, creation, _serializer);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            _options           = options;
            _connectionFactory = options.ConnectionFactory();

            _logger = options.Logger();

            Schema = new DocumentSchema(_options, _connectionFactory, _logger);


            _serializer = options.Serializer();

            var cleaner = new DocumentCleaner(_connectionFactory, Schema.As <DocumentSchema>());

            Advanced = new AdvancedOptions(cleaner, options, _serializer, Schema);

            Diagnostics = new Diagnostics(Schema);


            CreateDatabaseObjects();

            Transform = new DocumentTransforms(this);

            options.InitialData.Each(x => x.Populate(this));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            _options = options;
            _runner  = new CommandRunner(options.ConnectionFactory());

            var creation = options.AutoCreateSchemaObjects
                ? (IDocumentSchemaCreation) new DevelopmentSchemaCreation(_runner)
                : new ProductionSchemaCreation();

            Schema = new DocumentSchema(_options, _runner, creation);

            Schema.Alter(options.Schema);

            _serializer = options.Serializer();

            var cleaner = new DocumentCleaner(_runner, Schema);

            Advanced = new AdvancedOptions(cleaner, options);

            Diagnostics = new Diagnostics(Schema, new MartenQueryExecutor(_runner, Schema, _serializer, _parser, new NulloIdentityMap(_serializer)));


            if (options.RequestCounterThreshold.HasThreshold)
            {
                _runnerForSession = () => new RequestCounter(_runner, options.RequestCounterThreshold);
            }
            else
            {
                _runnerForSession = () => _runner;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            options.ApplyConfiguration();
            options.CreatePatching();
            options.Validate();
            Options = options;

            _logger = options.Logger();

            Tenancy = options.Tenancy;

            if (options.CreateDatabases != null)
            {
                IDatabaseGenerator databaseGenerator = new DatabaseGenerator();
                databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases);
            }

            Tenancy.Initialize();

            Schema = Tenancy.Schema;

            Storage = options.Storage;

            Storage.PostProcessConfiguration();

            Serializer = options.Serializer();

            if (options.UseCharBufferPooling)
            {
                _writerPool = new CharArrayTextWriter.Pool();
            }

            Advanced = new AdvancedOptions(this);

            Diagnostics = new Diagnostics(this);

            Transform = new DocumentTransforms(this, Tenancy.Default);

            options.InitialData.Each(x => x.Populate(this));

            Parser = new MartenExpressionParser(Serializer, options);

            HandlerFactory = new QueryHandlerFactory(this);

            Events = options.Events;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            options.Validate();
            options.CreatePatching();

            Options = options;

            _logger = options.Logger();

            Tenancy = options.Tenancy;
            Tenancy.Initialize();

            Schema = Tenancy.Schema;

            Storage = options.Storage;

            Storage.CompileSubClasses();

            Serializer = options.Serializer();

            if (options.UseCharBufferPooling)
            {
                _writerPool = new CharArrayTextWriter.Pool();
            }

            Advanced = new AdvancedOptions(this);

            Diagnostics = new Diagnostics(this);

            Transform = new DocumentTransforms(this, Tenancy.Default);

            options.InitialData.Each(x => x.Populate(this));

            Parser = new MartenExpressionParser(Serializer, options);

            HandlerFactory = new QueryHandlerFactory(this);

            Events = options.Events;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            _options           = options;
            _connectionFactory = options.ConnectionFactory();

            _logger = options.Logger();

            Schema = new DocumentSchema(_options, _connectionFactory, _logger);


            _serializer = options.Serializer();

            var cleaner = new DocumentCleaner(_connectionFactory, Schema.As <DocumentSchema>());

            Advanced = new AdvancedOptions(cleaner, options, _serializer, Schema);

            Diagnostics = new Diagnostics(Schema);

            EventStore = new EventStoreAdmin(Schema, _connectionFactory, _options, _serializer);

            CreateDatabaseObjects();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Creates a new DocumentStore with the supplied StoreOptions
        /// </summary>
        /// <param name="options"></param>
        public DocumentStore(StoreOptions options)
        {
            options.ApplyConfiguration();
            options.CreatePatching();
            options.Validate();

            Options      = options;
            _logger      = options.Logger();
            Serializer   = options.Serializer();
            _retryPolicy = options.RetryPolicy();

            if (options.CreateDatabases != null)
            {
                IDatabaseGenerator databaseGenerator = new DatabaseGenerator();
                databaseGenerator.CreateDatabases(Tenancy, options.CreateDatabases);
            }

            Tenancy.Initialize();

            Schema = Tenancy.Schema;

            Storage.PostProcessConfiguration();

            _writerPool = options.UseCharBufferPooling ? MemoryPool <char> .Shared : new AllocatingMemoryPool <char>();

            Advanced = new AdvancedOptions(this);

            Diagnostics = new Diagnostics(this);

            Transform = new DocumentTransforms(this, Tenancy.Default);

            Parser = new MartenExpressionParser(Serializer, options);

            HandlerFactory = new QueryHandlerFactory(this);

            options.InitialData.Each(x => x.Populate(this));
        }