From 516aeb254b2ad6dd9744aacd4fb66130d8ddbc9a Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Mon, 18 Jul 2022 16:07:34 -0500 Subject: [PATCH] feat: added NitrideBuilder.UseModule() methods to simplify adding modules --- src/Nitride/NitrideBuilder.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/Nitride/NitrideBuilder.cs b/src/Nitride/NitrideBuilder.cs index d184ee3..d3845de 100644 --- a/src/Nitride/NitrideBuilder.cs +++ b/src/Nitride/NitrideBuilder.cs @@ -13,6 +13,8 @@ using Serilog; using Zio; using Zio.FileSystems; +using Module = Autofac.Module; + namespace Nitride; /// @@ -99,6 +101,31 @@ public class NitrideBuilder .RunAsync(); } + /// + /// Initialize the builder with a given Autofac module. + /// + /// The type of module to use. + /// The builder to chain operations. + public NitrideBuilder UseModule() + where TModule : Module, new() + { + this.ConfigureContainer(x => x.RegisterModule()); + + return this; + } + + /// + /// Initialize the builder with a given Autofac module. + /// + /// The type of module to use. + /// The builder to chain operations. + public NitrideBuilder UseModule(Module module) + { + this.ConfigureContainer(x => x.RegisterModule(module)); + + return this; + } + /// /// Sets the description of the builder. ///