/// <summary>
        /// Uses the EntityFramework Core as a storage for saving and loading data.
        /// <para>
        /// Note: It means Parbad can save and load the data in different database providers
        /// such as SQL Server, MySql, Sqlite, PostgreSQL, Oracle, InMemory, etc.
        /// For more information see: https://docs.microsoft.com/en-us/ef/core/providers/.
        /// </para>
        /// <para>Note: This database is only for internal usages such as saving and loading payment information.
        /// You don't need to think about merging and using this database with your own database.
        /// The important payment information such as Tracking Number, Transaction Code, etc. will you get from the result of
        /// all payment requests.</para>
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="configureEfCoreOptions">Configures the EntityFrameworkCore options for Parbad.</param>
        public static IStorageBuilder UseEfCore(this IStorageBuilder builder, Action <EntityFrameworkCoreOptions> configureEfCoreOptions)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (configureEfCoreOptions == null)
            {
                throw new ArgumentNullException(nameof(configureEfCoreOptions));
            }

            var options = new EntityFrameworkCoreOptions();

            configureEfCoreOptions(options);

            builder.Services.Configure(configureEfCoreOptions);

            builder.Services.AddDbContext <ParbadDataContext>(dbBuilder =>
            {
                options.ConfigureDbContext?.Invoke(dbBuilder);
            });

            builder.AddStorage <EntityFrameworkCoreStorage>(ServiceLifetime.Transient);

            builder.AddStorageManager <EntityFrameworkCoreStorageManager>(ServiceLifetime.Transient);

            return(builder);
        }
        /// <summary>
        /// Uses <see cref="IDistributedCache"/> for saving and loading data.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="configureOptions"></param>
        public static IStorageBuilder UseDistributedCache(this IStorageBuilder builder, Action <DistributedCacheStorageOptions> configureOptions)
        {
            builder.Services.Configure(configureOptions);
            builder.AddStorage <DistributedCacheStorage>(ServiceLifetime.Transient);

            return(builder);
        }
        /// <summary>
        /// Uses the Entityframework Core as a storage for saving and loading data.
        /// <para>
        /// Note: It means Parbad can save and load the data in different database providers
        /// such as SQL Server, MySql, Sqlite, PostgreSQL, Oracle, InMemory, etc.
        /// For more information see: https://docs.microsoft.com/en-us/ef/core/providers/.
        /// </para>
        /// <para>Note: This database is only for internal usages such as saving and loading payment information.
        /// You don't need to think about merging and using this database with your own database.
        /// The important payment information such as Tracking Number, Transaction Code, etc. will you get from the result of
        /// all payment requests.</para>
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="configureDatabaseBuilder">Configure what database must be used and how it must be created.</param>
        public static IEntityFrameworkCoreStorageBuilder UseEntityFrameworkCore(this IStorageBuilder builder,
                                                                                Action <DbContextOptionsBuilder> configureDatabaseBuilder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (configureDatabaseBuilder == null)
            {
                throw new ArgumentNullException(nameof(configureDatabaseBuilder));
            }

            builder.Services.AddDbContext <ParbadDataContext>(configureDatabaseBuilder);

            builder.AddStorage <EntityFrameworkCoreStorage>(ServiceLifetime.Transient);

            return(new EntityFrameworkCoreStorageBuilder(builder.Services));
        }