Closed
Description
I use Autofac DynamicProxy2 do AOP logging. If I register like this:
builder.RegisterAssemblyTypes(assemblys.ToArray()).Where(t => t.Name.EndsWith("ServiceImpl"))
.AsImplementedInterfaces()
.InstancePerLifetimeScope()
.PropertiesAutowired()
.EnableInterfaceInterceptors()
.InterceptedBy(typeof(LogInterceptor));
;
then ValuesServiceImpl instance can be auto wire to property, like this:
public class ValuesController : ApiController
{
public IValuesService ValuesService { get; set; }
}
But if I use PropertiesAutowired(PropertyWiringOptions.AllowCircularDependencies)
builder.RegisterAssemblyTypes(assemblys.ToArray()).Where(t => t.Name.EndsWith("ServiceImpl"))
.AsImplementedInterfaces()
.InstancePerLifetimeScope()
.PropertiesAutowired(PropertyWiringOptions.AllowCircularDependencies)
.EnableInterfaceInterceptors()
.InterceptedBy(typeof(LogInterceptor));
then PropertiesAutowired not working, ValuesService property is null.
In my project I must allow Circular Dependencies, and I prefer use EnableInterfaceInterceptors instead of EnableClassInterceptors
Metadata
Metadata
Assignees
Labels
No labels