Suppose all the dependencies have already been registered at the beginning of the program. At later points in the program how can you use AutoFac to create a new object with a parameterless constructor and inject the registered properties into the object?
Suppose all the dependencies have already been registered at the beginning of the program.
Share
You can register your object in the container with
PropertiesAutowiredthen use resolve when you need an instace:Or if you don’t want to register in the container your can use the
InjectPropertiesmethod on an existing instance: