This can be done using a module, for example
class InjectPropertiesByDefaultModule : Autofac.Module {
protected override void AttachToComponentRegistration(
IComponentRegistration registration,
IComponentRegistry registry) {
registration.Activating += (s, e) => {
e.Context.InjectProperties(e.Instance);
};
}
}
Then:
builder.RegisterModule<InjectPropertiesByDefaultModule>();
I think you may be mistaken in the parameter truebefore PropertiesAutowired- it determines how circular dependencies are supported, and probably it should stay false. To emulate a setting true, you can attach to Activatedinstead of Activatingabove.
, , "" , ILog. (, readonly), ( , .)
, , .
"Null Object" .