Black.Beard.Web.Server
1.0.25
See the version list below for details.
dotnet add package Black.Beard.Web.Server --version 1.0.25
NuGet\Install-Package Black.Beard.Web.Server -Version 1.0.25
<PackageReference Include="Black.Beard.Web.Server" Version="1.0.25" />
paket add Black.Beard.Web.Server --version 1.0.25
#r "nuget: Black.Beard.Web.Server, 1.0.25"
// Install Black.Beard.Web.Server as a Cake Addin #addin nuget:?package=Black.Beard.Web.Server&version=1.0.25 // Install Black.Beard.Web.Server as a Cake Tool #tool nuget:?package=Black.Beard.Web.Server&version=1.0.25
Net.Server
Provide a service base for just concentrate on services
Installation
$ install-package Black.Beard.Web.Server
Usage
/// <summary>
/// Startup class par parameter
/// </summary>
public class Startup : StartupBase
{
/// <summary>
/// Initializes a new instance of the <see cref="Startup"/> class.
/// </summary>
/// <param name="configuration">The configuration.</param>
public Startup(IConfiguration configuration)
: base(configuration)
{
}
public override void ConfigureServices(IServiceCollection services)
{
// Yours configuration
base.ConfigureServices(services);
}
/// <summary>
/// Configures the specified application.
/// </summary>
/// <param name="app">The application.</param>
/// <param name="env">The env.</param>
/// <param name="loggerFactory">The logger factory.</param>
public override void ConfigureApplication(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
base.ConfigureApplication(app, env, loggerFactory);
app
.UseHttpsRedirection()
.UseRouting()
.UseListener()
;
}
}
internal class Program
{
/// <summary>
/// Main entry point of the application.
/// </summary>
/// <param name="args"></param>
public static void Main(string[] args)
{
var service = GetService(args);
service.Run();
}
public static ServiceRunnerBase GetService(string[] args)
{
return new ServiceRunner<Startup>(args);
}
}
You can configure WebApplicationBuilder like that
[ExposeClass(ConstantsCore.Initialization, ExposedType = typeof(IApplicationBuilderInitializer<WebApplicationBuilder>), LifeCycle = IocScopeEnum.Transiant)]
public class ModuleInitializeWebApplicationBuilder : ApplicationInitializerBase<WebApplicationBuilder>
{
public override void Execute(WebApplicationBuilder builder)
{
var services = builder.Services;
services.AddAuthorization(options =>
{
options.AddPolicy("Admin", policy =>
{
policy.RequireRole("Admin");
});
});
}
}
You can configure service like that
[ExposeClass(ConstantsCore.Initialization, ExposedType = typeof(IApplicationBuilderInitializer<WebApplication>), LifeCycle = IocScopeEnum.Transiant)]
public class ModuleInitializeWebApplication : ApplicationInitializerBase<WebApplication>
{
public override void Execute(WebApplication builder)
{
}
}
All json files existing in the root of the application and in the folder Configs are loaded, and you can append configuration fragment like that
[ExposeClass(ConstantsCore.Initialization, ExposedType = typeof(IInjectBuilder<IConfigurationBuilder>))]
public class ConfigurationBuilderBuilder : InjectBuilder<IConfigurationBuilder>
{
public override object Execute(IConfigurationBuilder service)
{
service.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile("Configs/appsettings.json", optional: true, reloadOnChange: true)
;
return 0;
}
}
You can inject configuration like that. in the sqample ConnectionStringSettings is the name of the section in the configuration documents
[ExposeClass(ConstantsCore.Configuration, ConfigurationKey = "ConnectionStringSettings", LifeCycle = IocScopeEnum.Transiant)]
public partial class ConnectionSettings
{
public ConnectionSettings()
{
this.ConnectionStringSettings = new ConnectionStringSettings();
}
public ConnectionStringSettings ConnectionStringSettings { get; set; }
}
// You can ask the configuration like that
var connectionSettings = builder.Services.GetService<Option<ConnectionSettings>>();
You can inject service like that
[ExposeClass(ConstantsCore.Service, LifeCycle = IocScopeEnum.Transiant)]
public partial class MyService : IService
{
public MyService()
{
}
public void Execute()
{
Console.WriteLine("MyService");
}
}
// You can ask the service like that
var instance = builder.Services.GetService<MyService>();
You can using the injection like that
TService uiService = builder.Services.GetService<TService>();
var loader = new InjectionLoader<TService>(UIConstants.LeftMenu, builder.Services)
.LoadModules(c =>
{
})
.Execute(uiService);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Black.Beard.ComponentModel (>= 1.0.86)
- Black.Beard.ComponentModel.Attributes (>= 1.0.86)
- Black.Beard.Helpers (>= 2.0.32)
- Black.Beard.Helpers.ContentLoaders (>= 2.0.32)
- Black.Beard.Helpers.ContentLoaders.Files (>= 2.0.32)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.1)
- Microsoft.Extensions.Configuration.CommandLine (>= 8.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 8.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.Extensions.Configuration.UserSecrets (>= 8.0.0)
- NLog (>= 5.2.8)
- NLog.Web.AspNetCore (>= 5.3.8)
- OpenTelemetry.Exporter.Console (>= 1.8.1)
- OpenTelemetry.Extensions.Hosting (>= 1.8.1)
- OpenTelemetry.Instrumentation.AspNetCore (>= 1.8.1)
- OpenTelemetry.Instrumentation.Http (>= 1.8.1)
- OpenTelemetry.Instrumentation.Runtime (>= 1.8.0)
- Swashbuckle.AspNetCore (>= 6.5.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.31 | 127 | 5/6/2024 |
1.0.30 | 129 | 5/5/2024 |
1.0.29 | 103 | 4/24/2024 |
1.0.28 | 122 | 4/24/2024 |
1.0.27 | 117 | 4/24/2024 |
1.0.26 | 119 | 4/24/2024 |
1.0.25 | 111 | 4/22/2024 |
1.0.24 | 120 | 4/18/2024 |
1.0.23 | 117 | 4/15/2024 |
1.0.22 | 126 | 4/14/2024 |
1.0.21 | 115 | 4/13/2024 |
1.0.20 | 113 | 4/12/2024 |
1.0.19 | 110 | 4/8/2024 |
1.0.18 | 110 | 4/7/2024 |
1.0.17 | 134 | 3/30/2024 |
1.0.16 | 121 | 3/28/2024 |
1.0.15 | 131 | 3/27/2024 |
1.0.14 | 135 | 3/27/2024 |
1.0.13 | 99 | 3/27/2024 |
1.0.12 | 114 | 3/26/2024 |
1.0.11 | 115 | 3/26/2024 |
1.0.10 | 121 | 3/24/2024 |
1.0.9 | 119 | 3/24/2024 |
1.0.8 | 114 | 3/24/2024 |
1.0.7 | 120 | 3/24/2024 |