Esempio n. 1
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));
        }
Esempio 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();

            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;
        }
Esempio n. 3
0
        public void Initialize()
        {
            ConfigureFromCanConfigurables();
            InitializeCulture();

            var initializers = new Action[] {
                () => Serialization.Initialize(Container),
                () => Commands.Initialize(Container),
                () => Container.Get <IEventsConfiguration>().Initialize(Container),
                () => Tasks.Initialize(Container),
                () => Frontend.Initialize(Container),
                () => CallContext.Initialize(Container),
                () => ExecutionContext.Initialize(Container),
                () => Security.Initialize(Container),
                () => Tenancy.Initialize(Container),
                () => DefaultStorage.Initialize(Container)
            };

            Parallel.ForEach(initializers, initializator => initializator());
            ConfigurationDone();
        }
Esempio n. 4
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;
        }
Esempio n. 5
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));
        }