From 1abdd13c9133d36b8a2b1ec4cfc8fe8f1f4f4249 Mon Sep 17 00:00:00 2001 From: Simon Gockner Date: Tue, 9 Jul 2019 15:19:56 +0200 Subject: [PATCH] - add first draft of fromAssembly --- FromAssembly.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/FromAssembly.md b/FromAssembly.md index 471f7e8..5940d52 100644 --- a/FromAssembly.md +++ b/FromAssembly.md @@ -1 +1,29 @@ -The `FromAssembly` class is a static helper class that supplies methods to find the wanted `Assembly` for an `IAssemblyInstaller`. Is acts similar to a factory in the way that its methods return a new instance of an `IAssemblyInstaller` with the assembly that they provide. +The `FromAssembly` class is a static helper class that supplies methods to find the wanted `Assembly` for an `IAssemblyInstaller`. +It acts similar to a factory in the way that its methods return a new instance of an `IAssemblyInstaller` with the assembly that they provide. + +There are two different methods that create `IAssemblyInstaller`s: + +## `This()` + +The `This()` method creates an `IAssemblyInstaller` that installs from the `Assembly` that calls the method. +This is done by using the `Assembly.GetCallingAssembly()` method: + +```c# +public static IAssemblyInstaller This() +{ + Assembly assembly = Assembly.GetCallingAssembly(); + return new AssemblyInstaller(assembly); +} +``` + +## `Instance()` + +The `Instance()` method creates an `IAssemblyInstaller` that installs from the `Assembly` instance that is given to the method. +This is done by straightforwardly creating an `IAssemblyInstaller`: + +```c# +public static IAssemblyInstaller Instance(Assembly assembly) +{ + return new AssemblyInstaller(assembly); +} +```