public BlogEntityDbContext CreateDbContext(string[] args)
        {
            var builder = new DbContextOptionsBuilder <BlogEntityDbContext>();

            DbContextOptionsHelper.ConfigureOptionsBuilder(builder, DesignTimeConnectionString);
            return(new BlogEntityDbContext(builder.Options));
        }
        public BlogEntityDbContext CreateDbContext(string[] args)
        {
            var builder = new DbContextOptionsBuilder <BlogEntityDbContext>();

            var connectionString = GetConfiguration().GetConnectionString("DefaultConnection");

            DbContextOptionsHelper.ConfigureOptionsBuilder(builder, connectionString);

            return(new BlogEntityDbContext(builder.Options));
        }
        /// <summary>
        /// Adds PineBlog Entity Framework Core services to the specified services collection.
        /// </summary>
        /// <param name="services">The services available in the application.</param>
        /// <param name="configuration">The application configuration properties.</param>
        /// <returns>The original services object.</returns>
        public static IServiceCollection AddPineBlogEntityFrameworkCore(this IServiceCollection services, IConfiguration configuration)
        {
            if (((IConfigurationRoot)configuration).Providers.SingleOrDefault(p => p.GetType() == typeof(BlogSettingsConfigurationProvider)) == null)
            {
                throw new ConfigurationException("The PineBlog IConfigurationProvider(s) are not configured, please add \"AddPineBlogConfiguration\" to the \"ConfigureAppConfiguration\" on the \"IWebHostBuilder\".")
                      {
                          HelpLink = "https://github.com/ofpinewood/pineblog/blob/master/docs/getting-started.md#blog-settings-configurationprovider"
                      };
            }

            services.AddDbContextPool <IBlogEntityDbContext, BlogEntityDbContext>((provider, options) =>
            {
                var blogOptions      = provider.GetRequiredService <IOptions <PineBlogOptions> >();
                var connectionString = configuration.GetConnectionString(blogOptions.Value.ConnectionStringName);
                DbContextOptionsHelper.ConfigureOptionsBuilder(options, connectionString);
            });

            return(services);
        }