Skip to content

Provides modules for registration of types from popular libraries using Jab

License

Notifications You must be signed in to change notification settings

skarllot/jab-modules

Repository files navigation

Raiqub Jab Modules

Provides modules for registration of types from popular libraries using Jab

Build status OpenSSF Scorecard Code coverage Mutation testing badge GitHub license

🏃 Quickstart   |   📗 Guide   |   🔄 Migration


Features

  • Provides Jab modules for registering popular .NET libraries
  • Modules provides registration methods similar to the ones from original library

NuGet Packages

  • NuGet Raiqub.JabModules.MicrosoftExtensionsOptions: provides a Jab module for registering types from Microsoft.Extensions.Options library.

Prerequisites

Before you begin, you'll need the following:

  • .NET Core 6.0 or greater installed on your machine
  • An IDE such as Visual Studio, Visual Studio Code, or JetBrains Rider

Quickstart

On a project defining a service provider using Jab, add a NuGet package from Raiqub.JabModules:

<ItemGroup>
    <PackageReference Include="Jab" Version="0.10.1" />
    <PackageReference Include="Raiqub.JabModules.MicrosoftExtensionsOptions" Version="1.0.0" />
</ItemGroup>

Then add the provided module to the container:

[ServiceProvider]
[Import(typeof(IOptionsModule))]
internal partial class MyServiceProvider

Guide

Microsoft.Extensions.Options

The NuGet package Raiqub.JabModules.MicrosoftExtensionsOptions provides a Jab module for registering types from Microsoft.Extensions.Options library.

[ServiceProvider]
[Import(typeof(IOptionsModule))]
[Transient<IConfigureOptions<FooOptions>>(Factory = nameof(ConfigureMyConfig))]
internal partial class MyServiceProvider
{
    private static IConfigureOptions<MyConfigOptions> ConfigureMyConfig() =>
        IOptionsModule.Configure<MyConfigOptions>(options => options.Key1 = "Jane");
}

public class MyConfigOptions
{
    public string Key1 { get; set; }
    public int Key2 { get; set; }
    public int Key3 { get; set; }
}

Contributing

If something is not working for you or if you think that the source file should change, feel free to create an issue or Pull Request. I will be happy to discuss and potentially integrate your ideas!

License

This library is licensed under the MIT License.

About

Provides modules for registration of types from popular libraries using Jab

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages