Bonfire.Hosting.ServiceProcess
2023.4.8.3
dotnet add package Bonfire.Hosting.ServiceProcess --version 2023.4.8.3
NuGet\Install-Package Bonfire.Hosting.ServiceProcess -Version 2023.4.8.3
<PackageReference Include="Bonfire.Hosting.ServiceProcess" Version="2023.4.8.3" />
paket add Bonfire.Hosting.ServiceProcess --version 2023.4.8.3
#r "nuget: Bonfire.Hosting.ServiceProcess, 2023.4.8.3"
// Install Bonfire.Hosting.ServiceProcess as a Cake Addin #addin nuget:?package=Bonfire.Hosting.ServiceProcess&version=2023.4.8.3 // Install Bonfire.Hosting.ServiceProcess as a Cake Tool #tool nuget:?package=Bonfire.Hosting.ServiceProcess&version=2023.4.8.3
❤️🔥 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 Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- Bonfire.Hosting (>= 2023.4.8.3)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Hosting (>= 7.0.0)
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 |
---|---|---|
2023.4.8.3 | 204 | 4/8/2023 |
Initial release.