StartupOrchestration.NET 0.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package StartupOrchestration.NET --version 0.0.5
NuGet\Install-Package StartupOrchestration.NET -Version 0.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StartupOrchestration.NET" Version="0.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StartupOrchestration.NET --version 0.0.5
#r "nuget: StartupOrchestration.NET, 0.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StartupOrchestration.NET as a Cake Addin
#addin nuget:?package=StartupOrchestration.NET&version=0.0.5

// Install StartupOrchestration.NET as a Cake Tool
#tool nuget:?package=StartupOrchestration.NET&version=0.0.5

StartupOrchestration.NET

Main Status NuGet Downloads NuGet Version codecov Quality Gate Status

StartupOrchestration.NET is a .NET library that provides an interface for orchestrating dependency registrations in a way that is agnostic to the presentation layer. It allows for the separation of concerns between the presentation layer and the application layer by providing a way for the application layer to manage service registrations without any presentation-specific dependencies.

Features

  • Enables application layer to manage service registrations independently of the presentation layer.
  • Enables separation of concerns between the presentation layer and the application layer.
  • Provides a generic implementation that can be easily customized for different types of applications.
  • Provides a flexible interface for orchestrating service registrations that is agnostic to the presentation layer.
  • Designed to be inherited from by a startup class in the presentation layer.

Installation

You can install the package via NuGet. Search for StartupOrchestration.NET or run the following command:

dotnet add package StartupOrchestration.NET

Usage

To use StartupOrchestration.NET, you need to implement the ServiceRegistrationOrchestrator class in your application layer, and inherit from StartupOrchestrator<TOrchestrator> in your presentation layer.

Here's an example of how you can use StartupOrchestration.NET in your application:

// Application layer
public class AppStartupOrchestrator : ServiceRegistrationOrchestrator
{
    /// <inheritdoc />
    protected override ILogger StartupLogger => NullLogger.Instance;

    public AppStartupOrchestrator()
    {
        // Register shared services
        ServiceRegistrationExpressions.Add((services, config) => services.RegisterConfiguredOptions<RepositoryOptions>(config));
        ServiceRegistrationExpressions.Add((services, config) => services.AddTransient<IMyRepository, MyRepository>());
        ServiceRegistrationExpressions.Add((services, config) => services.AddTransient<IEmailService, EmailService>());
    }
}

// Presentation layer
public class WebApiStartup : StartupOrchestrator<AppStartupOrchestrator>
{
    public WebApiStartup() : base(configuration)
    {
        ServiceRegistrationExpressions.Add((services, config) => services.RegisterConfiguredOptions<SwaggerOptions>(config));
        ServiceRegistrationExpressions.Add((services, config) => services.AddTransient<IService, Service>());
        ServiceRegistrationExpressions.Add((services, config) => services.AddAuthorization());
        ServiceRegistrationExpressions.Add((services, config) => services.AddSwagger());
    }

    protected override void AddConfigurationProviders(IConfigurationBuilder builder)
    {
        builder.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
    }
}

public static class ServiceCollectionExtensions
{
    // Helper method for registering options classes using the IOptions pattern
    public static void RegisterConfiguredOptions<T>(this IServiceCollection servicesCollection, IConfiguration configuration) where T : class, new()
    {
        string sectionKey = typeof(T).Name;
        IConfigurationSection section = configuration.GetSection(sectionKey.Replace("Options", ""));

        var options = new T();
        section.Bind(options);

        servicesCollection.Configure<T>(section);
    }
}

Here, AppStartupOrchestrator is the implementation of ServiceRegistrationOrchestrator in the application layer, and WebApiStartup is the implementation of StartupOrchestrator<TOrchestrator> in the presentation layer.

Contributing

Contributions are welcome! If you find a bug, want to suggest a feature, or want to contribute code, please open an issue or submit a pull request.

License

This package is released under the MIT License. See LICENSE for more information.

Product 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. 
.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1 159 5/1/2023
1.0.0 195 4/24/2023
0.0.6 155 4/24/2023
0.0.5 139 4/24/2023
0.0.4 149 4/24/2023
0.0.3 146 4/23/2023
0.0.2 161 4/22/2023