MilNet is a set of .NET Core libraries. MilNet provides a ready-to-use template for your ASP.NET Core applications, with the following features:
- Open API (Swagger)
- Connection to basic services to send feedbacks, emails
- Application contacts information
- Application last release information
- Authentication/Authorization management with IdentityServer4
- Logging with ElasticSearch
- Privacy and Cookies management (RGPD)
- Basic healthchecks
Other utilities are included into MilNet:
- Exceptions for Forbidden and Not Found responses
- CSV-like files interpretation
- Service to create HTTP requests with .NET Core Http Request Factory
MilNet works well with a vue.js Front application, using MilNode packages.
Warning! Watch the [Obsolete] attributes into the source code, they indicate features that will be deleted on the next major version!
If you want to propose a feature or to report a bug, please create a new issue. If you want to propose code source changes, please follow the steps below.
-
Installation process From your local computer, clone the repository.
dotnet restore
to install all dependenciesdotnet run
to build MilNet as a library
-
GitFlow Please follow the GitHub Flow:
- Create a branch from
master
- Commit your code changes
- Create a Pull Request to merge into the master
branch
- Create a branch from
-
Conditions to complete Pull Request To ensure minimal quality, branch policies have been set up for pull requests to the master branch:
- A new build must be validated before each pull request
- A project administrator must validate the code changes
- Import MilNet in your ASP.NET Core project with
Import-Package MilNet.Services.AspNetCore
- Create your
IWebHostBuilder
with theConfigureMilNetServices
extension, as in theProgram.cs
file:public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .ConfigureMilNetServices() .UseStartup<Startup>();
- Configure your
IServiceCollection
with theAddMilNetServices
extension, as in theStartup.cs
file:public void ConfigureServices(IServiceCollection services) { services.AddMilNetServices(configuration.GetSection("Services"); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); }
- Configuration your
IApplicationBuilder
with theUseMilNetServices
extension, as in theStartup.cs
file:public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseMilNetServices(); app.UseMvcWithDefaultRoute(); }
- Configure MilNet in your
appsettings.json
file:{ "ConnectionStrings": { "DefaultConnection": "XXX" }, "Logging": { "LogLevel": { "Default": "Warning" } }, "AllowedHosts": "*", "Services": { "ApplicationName": "MyAppName", "Log": { "ElasticSearchUrl": "http://localhost:9200" }, "Contact": { "Business": { "Email": "business-support@mysite.com", "Place": "Paris, France", "Url": "http://mysite.com/business-support", "Users": [ { "FirstName": "Antoine", "LastName": "Milochau", "Email": "antoine.milochau@mysite.com", "Place": "Paris, France" } ] }, "Technical": { "Email": "technical-support@mysite.com", "Place": "Paris, France", "Url": "http://mysite.com/technical-support", "Users": [] } }, "Release": { "Definition": "Development", "Name": "No release" } } }
Watch the [Obsolete] attributes into the source code, they indicate features that will be deleted on the next major version.