Bonfire.Hosting
2023.4.8.4
dotnet add package Bonfire.Hosting --version 2023.4.8.4
NuGet\Install-Package Bonfire.Hosting -Version 2023.4.8.4
<PackageReference Include="Bonfire.Hosting" Version="2023.4.8.4" />
<PackageVersion Include="Bonfire.Hosting" Version="2023.4.8.4" />
<PackageReference Include="Bonfire.Hosting" />
paket add Bonfire.Hosting --version 2023.4.8.4
#r "nuget: Bonfire.Hosting, 2023.4.8.4"
#:package Bonfire.Hosting@2023.4.8.4
#addin nuget:?package=Bonfire.Hosting&version=2023.4.8.4
#tool nuget:?package=Bonfire.Hosting&version=2023.4.8.4
❤️🔥 Bonfire.Net
Bonfire.Net is a collection of libraries that make it easy to add hosting and dependency injection to your .NET Framework applications. Say goodbye to boilerplate and hello to a cleaner, more testable codebase.
💁♀️ Getting Started
Get started by reviewing the answers to the following questions:
- How do I navigate the codebase with confidence?
- How can I help?
- How should I behave here?
- How do I report security concerns?
✅ Small changes, continuously integrated
Bonfire.Net employs workflows for continuous integration to ensure the repository is held to industry standards; here's the current state of those workflows:
💎 A few more gems
We believe in keeping the community informed, so here's a few more tidbits of information to satisfy some additional curiosities:
🔥 Working with Bonfire.Net
The primary objective of Bonfire.Net is to make it easy to add hosting and dependency injection to your .NET Framework applications. To do this, we offer a static class called Ignite that provides a simple way to bootstrap your application.
⚙️ Configuring the host
The Ignite class provides a number of methods that can be used to configure the host. For example, you can configure the host to use a specific startup class:
public static void Main(string[] args) =>
Ignite.UseStartup<Startup>(args)
.Run();
You can also configure the host manually by providing an Action<IHostBuilder>:
public static void Main(string[] args) =>
Ignite.Configure(builder =>
{
builder.UseContentRoot(Directory.GetCurrentDirectory());
builder.UseEnvironment(EnvironmentName.Development);
builder.UseStartup<Startup>();
}, args)
.Run();
▶️ Creating a Startup class
Get started by creating a Startup class with a ConfigureServices method:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
// Add services here
}
}
🏗️ Using Ignition for configuration
For those who like compile-time enforcement, the Ignition class provides an alternative to the reflective approach used by the Startup class that ensures method names don't have typos. To use it, derive your Startup class from Ignition and override the methods you need:
internal sealed class Startup : Ignition
{
protected override void Configure(IHostBuilder builder)
{
// Add configuration here
}
protected override void ConfigureServices(IServiceCollection services)
{
// Add services here
}
}
Then, update your Program class to use Ignite and the UseIgnition method which constrains the type argument to ensure it derives from Ignition:
public static void Main(string[] args) =>
Ignite.UseIgnition<Startup>(args)
.Run();
There is no inherit behavior in the Ignition class, so you'll need to provide your own implementation for each method you override.
🖥️ Hosting a Windows service
To run your application as a Windows Service, you'll need to add a reference to the Bonfire.Hosting.ServiceProcess package. Then derive from WindowsService instead of ServiceBase:
public class MyService : WindowsService
{
// The rest of your service stays the same.
}
Then, update your Program class to use Ignite:
public static void Main(string[] args) =>
Ignite.UseStartup<Startup>(args)
.Run<MyService>();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Hosting (>= 7.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Bonfire.Hosting:
| Package | Downloads |
|---|---|
|
Bonfire.Hosting.ServiceProcess
A lightweight solution that effectively reduces the boilerplate for adding hosting and dependency injection support to your applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2023.4.8.4 | 398 | 4/9/2023 |
| 2023.4.8.3 | 328 | 4/8/2023 |
Initial release.