- add first draft of fromAssembly

master
Simon Gockner 7 years ago
parent 6e2adc3ece
commit 1abdd13c91
  1. 30
      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);
}
```

Loading…
Cancel
Save