/// <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); }
/// <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); }
/// <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); }
/// <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; })); }
/// <summary> /// /// </summary> /// <param name="options"></param> /// <returns></returns> public static PeppyOptions UseEntityFrameworkCore <TContext>(this PeppyOptions options) where TContext : EFCroeDbContext { return(options.UseEntityFrameworkCore <TContext>(opt => { })); }
/// <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; })); }