Register Type
There are various ways to use Register. Let's take the following complex type as an example.
Register Concrete Type#
It can resolve like this:
Register as Interface#
It can resolve like this:
Register as multiple Interface#
It can resolve like this:
Register all implemented interfaces automatically#
It can resolve like this:
Register all implemented interfaces and concrete type#
It can resolve like this:
Register lifecycle marker interfaces#
note
this is similar to Register<GameController>(Lifetime.Singleton).AsImplementedInterfaces()
If you have multiple EntryPoints, you have the option to use the following declaration as grouping.
This is the same as:
Register instance#
note
RegisterIntance always Scoped lifetime. So it has no arguments.
It can resolve like this:
Register instance as interface#
Allow As* decrelations.
Register type-specific parameters#
If the types are not unique, but you have a dependency you want to inject at startup, you can use below:
Or, You can parameter name as a key.
It can resolve like this:
This Register is with only SomeService.