/// <summary>
        /// Initialized this instance but with some optional settings, like seed data and indexes.
        /// </summary>
        /// <param name="documentStore">The Raven document store.</param>
        /// <param name="seedData">Optional: A collection of data which will be 'seeded' into the new document store.</param>
        /// <param name="indexesToExecute">Optional: Any index(es) which should be executed during initialization. They need to be assignable from an AbstractIndexCreationTask.</param>
        /// <param name="assemblyToScanForIndexes">Optional: The assembly where the index(es) are located.</param>
        public static void InitializeWithDefaults(this IDocumentStore documentStore,
                                                  IEnumerable<IEnumerable> seedData = null,
                                                  ICollection<Type> indexesToExecute = null,
                                                  Type assemblyToScanForIndexes = null)
        {
            // Default initializtion;
            documentStore.Initialize();

            // Index initialisation.
            if (indexesToExecute != null)
            {
                Type[] indexes = (from type in indexesToExecute
                                  where typeof(AbstractIndexCreationTask).IsAssignableFrom(type)
                                  select type).ToArray();
                if (indexes.Length != indexesToExecute.Count)
                {
                    throw new InvalidOperationException("One or more of the provided indexes are not assignable from an AbstractIndexCreationTask. Please confirm that all the indexes provided are assignable from an AbstractIndexCreationTask.");
                }

                IndexCreation.CreateIndexes(new CompositionContainer(new TypeCatalog(indexes)), documentStore);
            }
            else if (assemblyToScanForIndexes != null)
            {
                IndexCreation.CreateIndexes(assemblyToScanForIndexes.Assembly, documentStore);
            }

            // Create our Seed Data (if provided).
            if (seedData != null)
            {
                CreateSeedData(seedData, documentStore);
            }

            // Now lets check to make sure there are now errors.
            documentStore.AssertDocumentStoreErrors();
        }
        /// <summary>
        ///     Initialized this instance but with some optional settings, like seed data and indexes.
        /// </summary>
        /// <param name="documentStore">The Raven document store.</param>
        /// <param name="seedData">Optional: A collection of data which will be 'seeded' into the new document store.</param>
        /// <param name="indexesToExecute">Optional: Any index(es) which should be executed during initialization. They need to be assignable from an AbstractIndexCreationTask.</param>
        /// <param name="assembliesToScanForIndexes">Optional: The assembly where the index(es) are located.</param>
        /// <param name="areDocumentStoreErrorsTreatedAsWarnings">Optional: If there are any server errors, do we downgrade them as warnings or keep them as errors, which stops further processing of the document store.</param>
        public static async Task InitializeWithDefaultsAsync(this IDocumentStore documentStore,
            IEnumerable<IEnumerable> seedData = null,
            ICollection<Type> indexesToExecute = null,
            ICollection<Type> assembliesToScanForIndexes = null,
            bool areDocumentStoreErrorsTreatedAsWarnings = false)
        {
            // Default initialization;
            documentStore.Initialize();

            // Static indexes or ResultTransformers.
            CreateIndexes(indexesToExecute, assembliesToScanForIndexes, documentStore);

            // Create our Seed Data (if provided).
            if (seedData != null)
            {
                await CreateSeedDataAsync(seedData, documentStore);
            }

            // Now lets check to make sure there are now errors.
            documentStore.AssertDocumentStoreErrors(areDocumentStoreErrorsTreatedAsWarnings);

            // Display any statistics.
            ReportOnInitializedStatistics(documentStore);
        }
        public static void InitializeWithDefaults(this IDocumentStore documentStore, bool isDataToBeSeeded,
                                                  IList<Type> indexesToExecute)
        {
            Condition.Requires(documentStore).IsNotNull();

            // Default initializtion;
            documentStore.Initialize();

            // Index initialisation.
            if (indexesToExecute != null)
            {
                Type[] indexes = (from type in indexesToExecute
                                  where type.IsSubclassOf(typeof (AbstractIndexCreationTask))
                                  select type).ToArray();

                IndexCreation.CreateIndexes(new CompositionContainer(new TypeCatalog(indexes)), documentStore);
            }
            else
            {
                IndexCreation.CreateIndexes(typeof (RecentPopularTags).Assembly, documentStore);
            }

            // Create our Seed Data (if required).
            // NOTE: This would be handled differently if it was a -real- production system.
            //       Like, wrapping this called in a #if RELEASE #endif, for example.
            if (isDataToBeSeeded)
            {
                HelperUtilities.CreateSeedData(documentStore);
            }

            // Now lets check to make sure there are now errors.
            documentStore.AssertDocumentStoreErrors();
        }
 public static void InitializeWithDefaults(this IDocumentStore documentStore)
 {
     documentStore.Initialize();
     IndexCreation.CreateIndexes(typeof(ContactEmailsByConfirmationCode).Assembly, documentStore);
     documentStore.AssertDocumentStoreErrors();
 }