Learn how to customize framework configuration, work with repositories, build services and expose APIs through controllers.
Default framework configuration is already included. Feature development typically follows:
New43Arch includes default framework core configuration out of the box. This section explains how to customize the default behavior when needed.
Customize password policies, email requirements and lockout rules.
Change the connection string or database settings.
Configure license options from appsettings.
services.AddDataAccessCoreSqlServer<New43ArchDefaultDbContext, New43ArchUser, New43ArchRole, string>(
connectionString, licenseOptions,
options =>
{
options.Password.RequiredLength = 8;
options.Lockout.MaxFailedAccessAttempts = 5;
},
builder =>
{
builder.AddDefaultTokenProviders();
}
);
Repositories encapsulate persistence concerns, support CRUD operations, paged retrieval and UnitOfWork integration.
Configure optional add-ons using the provided extension methods and settings.
public static void ConfigureJobFlow(this IServiceCollection services,
ConfigurationManager config)
{
services.AddJobFlow(jobFlow =>
{
var licenseOptions = config.GetSection("New43ArchJobFlowLicense")
.Get();
jobFlow.UseLicense(license => licenseOptions);
jobFlow.UseHangfire(options =>
{
options.ConnectionString = config.GetConnectionString("DefaultConnection") ?? "";
});
});
}
public static class CachePulseConfiguration
{
public static void ConfigureCachePulse(
this IServiceCollection services,
ConfigurationManager config)
{
var licenseOptions = config.GetSection("New43ArchCachePulseLicense")
.Get();
services.AddCachePulseRedis(config, licenseOptions);
}
}
public static class BotProtectionConfiguration
{
public static void ConfigureBotProtection(
this IServiceCollection services,
ConfigurationManager config)
{
var licenseOptions = config.GetSection("New43ArchBotProtectionLicense").Get();
services.AddBotProtection(config, licenseOptions);
}
public static void UseBotProtectionMiddleware(this IApplicationBuilder app)
{
app.UseBotProtection();
}
}
{
"BotProtection": {
"IpRateLimit": {
"Requests": 60,
"PerSeconds": 60
},
"Burst": {
"Requests": 20,
"PerSeconds": 5
},
"BlockDurationSeconds": 600
}
}
public static class WhitelistConfiguration
{
public static void ConfigureWhitelist(this IServiceCollection services,
ConfigurationManager config)
{
var licenseOptions = config.GetSection(LicenseOptions.Section).Get();
services.AddWhitelist(config, licenseOptions);
}
public static void UseWhitelist(this IApplicationBuilder app,
ConfigurationManager config)
{
var licenseOptions = config.GetSection(LicenseOptions.Section).Get();
app.UseWhitelist(licenseOptions);
}
}
{
"Whitelist": {
"Clients": [
{
"ApiKey": "api-key-123",
"AllowedDomains": [
"www.example.com"
]
}
]
}
}