Using `asp.net 5` I'd like my controller to be injected with a `Func<T>`instead of `T`

For example:

```cs
public HomeController(Func<Interfaces.IUnitOfWork> uow)

```

Instead of

```cs
public HomeController(Interfaces.IUnitOfWork uow)

```

Is it possible with the built-in DI or am I forced to move to an external DI?
['https://Stackoverflow.com/questions/35736070', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/20335/']
`Func<T>` does not get registered or resolved by default but there is nothing stopping you from registering it yourself.

e.g.

```
services.AddSingleton(provider => 
  new Func<IUnitOfWork>(() => provider.GetService<IUnitOfWork>()));

```

Note that you will also need to register IUnitOfWork itself in the usual way.
As far as I'm aware deferring dependencies like this isn't possible using the current default IoC container within ASP.NET Core. I've not been able to get it working anyway!

To defer the initialisation of dependencies like this you'll need to implement an existing, more feature rich IoC container.