Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="options"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static PeppyOptions UseSqlSugarCore(this PeppyOptions options, Action <SqlSugarCoreOptions> configure)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            options.RegisterExtension(new SqlSugarCoreOptionsExtension(configure));

            return(options);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TDbContext"></typeparam>
        /// <param name="options"></param>
        /// <param name="configure"></param>
        /// <returns></returns>
        public static PeppyOptions UseEntityFrameworkCore <TDbContext>(this PeppyOptions options, Action <EFCoreOptions <TDbContext> > configure)
            where TDbContext : EFCroeDbContext
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            options.RegisterExtension(new EFCoreOptionsExtension <TDbContext>(configure));

            return(options);
        }
Esempio n. 3
0
        /// <summary>
        /// Adds and configures the consistence services for the consistency.
        /// </summary>
        /// <param name="services"></param>
        /// <param name="setupAction"></param>
        /// <returns></returns>
        public static IServiceCollection AddPeppyServices(this IServiceCollection services, Action <PeppyOptions> setupAction)
        {
            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            var options = new PeppyOptions();

            setupAction(options);
            foreach (var serviceExtension in options.Extensions)
            {
                serviceExtension.AddServices(services);
            }
            services.Configure(setupAction);

            return(services);
        }
Esempio n. 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="options"></param>
 /// <param name="connectionString"></param>
 /// <param name="dbType"></param>
 /// <returns></returns>
 public static PeppyOptions UseSqlSugarCore(this PeppyOptions options, string connectionString, DbType dbType)
 {
     return(options.UseSqlSugarCore(opt => { opt.ConnectionString = connectionString; opt.DbType = dbType; }));
 }
Esempio n. 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static PeppyOptions UseEntityFrameworkCore <TContext>(this PeppyOptions options)
     where TContext : EFCroeDbContext
 {
     return(options.UseEntityFrameworkCore <TContext>(opt => { }));
 }
Esempio n. 6
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="TContext"></typeparam>
 /// <param name="options"></param>
 /// <param name="connectionString"></param>
 /// <returns></returns>
 public static PeppyOptions UseEntityFrameworkCore <TContext>(this PeppyOptions options, string connectionString)
     where TContext : EFCroeDbContext
 {
     return(options.UseEntityFrameworkCore <TContext>(opt => { opt.ConnectionString = connectionString; }));
 }