Skip to content

Commit e0ff458

Browse files
authored
Update README.md
1 parent 68d1dd5 commit e0ff458

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

README.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,24 @@ Unity extension to integrate with [Microsoft.Extensions.DependencyInjection.Abst
1212
Install-Package Unity.Microsoft.DependencyInjection
1313
```
1414

15-
## First way:
15+
## Registration:
1616
- In the `WebHostBuilder` add `ConfigureServices(services => services.AddUnity())` method
1717

1818
```C#
1919
public static IWebHost BuildWebHost(string[] args) =>
2020
WebHost.CreateDefaultBuilder(args)
21-
.ConfigureServices(services => services.AddUnity())
21+
.UseUnityServiceProvider()
2222
.UseStartup<Startup>()
2323
.Build();
2424
```
2525
- Add method to your `Startup` class
2626
```C#
2727
public void ConfigureContainer(IUnityContainer container)
2828
{
29+
// Could be used to register more types
2930
container.RegisterType<IMyService, MyService>();
3031
}
3132
```
3233

33-
## Second way:
34-
- In the `ConfigureServices` method of your `Startup` class...
35-
- Register services from the `IServiceCollection`.
36-
- Build your container.
37-
- Call `ConfigureServices` extension on `IUnityContainer` and return it.
34+
For example of using Unity with Core 2.0 Web application follow [this link](https://github.com/unitycontainer/examples/tree/master/src/AspNetCoreExample)
3835

39-
```C#
40-
public IServiceProvider ConfigureServices(IServiceCollection services)
41-
{
42-
services.AddMvc();
43-
44-
var container = new UnityContainer();
45-
46-
container.RegisterType<IMyService, MyService>();
47-
48-
return container.ConfigureServices(services);
49-
}
50-
```

0 commit comments

Comments
 (0)