Backbone of selise in-house .net core framework
Build your own ECAP Microservices
Need anything?
Swagger /
Request Feature or Report bug
Some introduction of backend ecap-server-core-backendframework-netcore will be provided here.
Nuget | Status | Description |
---|---|---|
Selise.Ecap.Framework | Framework for CommandHandlers, EventHandlers, Repository etc | |
Selise.Ecap.WepApi.Netcore | WebApi project dependency | |
Selise.Ecap.Hosting | Background service dependency | |
Selise.Ecap.RowLevelSecurity | Use to maintain RowLevelSecurity | |
Selise.Ecap.Bus.Esb | English framework support |
To install the first nuget go to the WebService project of you solution and go to the Nuget Manager. Install the following Nuget
$ Install nuget Selise.Ecap.WebApi.NetCore
The go to the Background service project of you solution and go to the Nuget Manager. Install the following Nuget
$ Install nuget Selise.Ecap.Hosting
Finally, go to the Services project of you solution and go to the Nuget Manager. Install the following Nuget
$ Install nuget Selise.Ecap.Framework
After installing the dependencies above go to the Usage
section
Step 1: Initialize your WebService project with boilerplate code inside the Main method of Program.cs
var ecapWebApiPipelineBuilderOptions = new EcapWebApiPipelineBuilderOptions
{
UseFileLogging = true,
UseConsoleLogging = true,
CommandLineArguments = args,
UseAuditLoggerMiddleware = true,
AddApplicationServices = AddApplicationServices,
UseJwtBearerAuthentication = true,
AddRequiredQueues = AddRequiredQueues,
AddRequiredExchanges = AddRequiredExchanges
};
ecapWebApiPipelineBuilderOptions.AddRoutes = (appSettings, routeBuilder) =>
{
routeBuilder.MapRoute("Default", $"{appSettings.ServiceName}" + "/{controller}/{action}/{id?}");
};
var webHostBuilder = EcapWebApiPipelineBuilder.BuildEcapWebApiPipeline(ecapWebApiPipelineBuilderOptions);
await webHostBuilder.Build().RunAsync();
Step 2: Add these methods inside the WebService Program.cs file
private static IEnumerable<string> AddRequiredExchanges(IAppSettings appSettings)
{
return EventExchanges.GetExchangeNames();
}
private static IEnumerable<string> AddRequiredQueues(IAppSettings appSettings)
{
return new[] { ... };
}
private static void AddApplicationServices(IServiceCollection serviceCollection, IAppSettings appSettings)
{
serviceCollection.RegisterCollection(typeof(ICommandHandler<,>), new[] { typeof(...).Assembly });
}
Step 3: Initialize the Background service in a similar fasion
public static async Task Main(string[] args)
{
var rabbitMqHostBuilderOptions = new RabbitMqHostBuilderOptions
{
UseFileLogging = true,
UseConsoleLogging = true,
CommandLineArguments = args,
AddApplicationServices = AddApplicationServices,
AddAmpqMessageConsumerOptions = (appSettings) =>
{
var ampqMessageConsumerOptions = new AmpqMessageConsumerOptions();
ampqMessageConsumerOptions.ConsumerSubscriptions.ListenOn(..., 5);
return ampqMessageConsumerOptions;
}
};
var hostBuilder = RabbitMqHostBuilder.BuildRabbitMqHost(rabbitMqHostBuilderOptions);
await hostBuilder.Build().RunAsync();
}
private static void AddApplicationServices(IServiceCollection serviceCollection, IAppSettings appSettings)
{
serviceCollection.RegisterCollection(typeof(ICommandHandler<,>), new[] { typeof(...).Assembly });
}
Swagger Documentation
https://api-documentation.selise.biz/
Detailed changes for each release are documented in the release notes.
Copyright (c) 2012-present, SELISE