asp.net.core.helper is a library to greatly reduce asp.net boilerplate code and lets you focus on your domain specific stuff.
Use Nuget Package Manager to install the package into your project:
Install-Package asp.net.core.helper.core
Startup.cs: As Last steps before you Map your endpoints, use MigrateDatabase and/or SeedDatabase to get the Package working.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
...
app.UseRouting();
app.MigrateDatabase<SampleContext>();
app.SeedDatabase<SampleContext>(typeof(Startup));
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
Use this Extension to apply your EF Core Migrations properly
- Pomelo.EntityFrameworkCore.MySql (5.0.3) for MariaDb 10..6.4
Example Seed see UserSeed.cs
- L7: Inherit from BaseSeed with your Context as generic argument
- L10: Constructor to pass the Injected Context to the BaseClass
- L16: The unique Key of this seed
- L18: The Order in wich the seeds should be executed
- L20-36: This seed adds a default admin user to the Users Table
- NuGet
- CI / CD
- Document sources and sample
- Microsoft SQL Server IQueryProvider
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.