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;
|
||||||
using Zio.FileSystems;
|
using Zio.FileSystems;
|
||||||
|
|
||||||
|
using Module = Autofac.Module;
|
||||||
|
|
||||||
namespace Nitride;
|
namespace Nitride;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -99,6 +101,31 @@ public class NitrideBuilder
|
||||||
.RunAsync();
|
.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>
|
/// <summary>
|
||||||
/// Sets the description of the builder.
|
/// Sets the description of the builder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Reference in a new issue