From 326729108e539b8c499c3a674a3bf458a22a3b36 Mon Sep 17 00:00:00 2001 From: Mario Toffia Date: Mon, 5 Apr 2021 18:29:28 +0200 Subject: [PATCH] HostBuilder::UseHost -> WithService issue #185 --- Ductus.FluentDocker/Builders/HostBuilder.cs | 29 +++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Ductus.FluentDocker/Builders/HostBuilder.cs b/Ductus.FluentDocker/Builders/HostBuilder.cs index 0b4c41c..a9059ec 100644 --- a/Ductus.FluentDocker/Builders/HostBuilder.cs +++ b/Ductus.FluentDocker/Builders/HostBuilder.cs @@ -15,7 +15,8 @@ internal HostBuilder(IBuilder builder) : base(builder) public override IHostService Build() { - if (this.customHostService != null) { + if (this.customHostService != null) + { return this.customHostService; } @@ -36,12 +37,18 @@ public HostBuilder UseNative() return this; } - public HostBuilder UseHost(IHostService customHostService) { + /// + /// This function will use a custom host service already instantiated. + /// + /// The instantiated IHostService + /// Itself for fluent access. + public HostBuilder WithService(IHostService customHostService) + { this.customHostService = customHostService; return this; } - /// + /// /// Creates a `IHostService` based on a _URI_. /// /// The _URI_ to the docker daemon. @@ -54,15 +61,15 @@ public HostBuilder UseHost(IHostService customHostService) { /// it will try to get it from the environment _DOCKER_CERT_PATH_. /// /// Itself for fluent access. - public HostBuilder FromUri( - DockerUri uri, - string name = null, - bool isNative = true, - bool stopWhenDisposed = false, - bool isWindowsHost = false, - string certificatePath = null) + public HostBuilder FromUri( + DockerUri uri, + string name = null, + bool isNative = true, + bool stopWhenDisposed = false, + bool isWindowsHost = false, + string certificatePath = null) { - this.customHostService = new Hosts().FromUri(uri,name,isNative,stopWhenDisposed,isWindowsHost,certificatePath); + this.customHostService = new Hosts().FromUri(uri, name, isNative, stopWhenDisposed, isWindowsHost, certificatePath); return this; }