feat: added NitrideBuilder.UseModule() methods to simplify adding modules
This commit is contained in:
parent
6b4fb3f840
commit
516aeb254b
1 changed files with 27 additions and 0 deletions
|
@ -13,6 +13,8 @@ using Serilog;
|
|||
using Zio;
|
||||
using Zio.FileSystems;
|
||||
|
||||
using Module = Autofac.Module;
|
||||
|
||||
namespace Nitride;
|
||||
|
||||
/// <summary>
|
||||
|
@ -99,6 +101,31 @@ public class NitrideBuilder
|
|||
.RunAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the builder with a given Autofac module.
|
||||
/// </summary>
|
||||
/// <typeparam name="TModule">The type of module to use.</typeparam>
|
||||
/// <returns>The builder to chain operations.</returns>
|
||||
public NitrideBuilder UseModule<TModule>()
|
||||
where TModule : Module, new()
|
||||
{
|
||||
this.ConfigureContainer(x => x.RegisterModule<TModule>());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the builder with a given Autofac module.
|
||||
/// </summary>
|
||||
/// <typeparam name="TModule">The type of module to use.</typeparam>
|
||||
/// <returns>The builder to chain operations.</returns>
|
||||
public NitrideBuilder UseModule(Module module)
|
||||
{
|
||||
this.ConfigureContainer(x => x.RegisterModule(module));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the description of the builder.
|
||||
/// </summary>
|
||||
|
|
Reference in a new issue