use Foo as name of class

master
Simon Gockner 7 years ago
parent cdd87fdb71
commit 8a6a14669d
  1. 6
      Simple-Usage-of-Lightweight-IOC-Container.md

@ -15,13 +15,13 @@ There are multiple ways to accomplish this and the best solution depends on the
In this simple usage guide we will only take a look at the most straightforward way that is to just register the interfaces and their classes with the `IocContainer`:
```c#
container.Register(new DefaultRegistration<IInterface>(typeof(IInterface), typeof(Implementation), Lifestyle.Transient));
container.Register(new DefaultRegistration<IInterface>(typeof(IFoo), typeof(Foo), Lifestyle.Transient));
```
To make this even easier there is a [`RegistrationFactory`](RegistrationFactory) that helps you create the `IRegistrationBase` you need:
```c#
container.Register(RegistrationFactory.Register<IInterface, Implementation>());
container.Register(RegistrationFactory.Register<IFoo, Foo>());
```
There are multiple [[lifestyles|Lifestyles]] available, make sure you choose the correct one for your need.
@ -31,7 +31,7 @@ There are multiple [[lifestyles|Lifestyles]] available, make sure you choose the
To resolve an instance with the `IocContainer`, do the following:
```c#
IInterface interface = container.Resolve<IInterface>();
IFoo interface = container.Resolve<IFoo>();
```
## Disposing Container

Loading…
Cancel
Save