我有如下所示的具有依賴性的代碼部分:AutoFac:PropertyWiringFlags.AllowCircularDependencies是做什麼的?
public class MyPage : Page //ASPX WebForms page
{
public IPersonBl PersonBl { get; set; }
}
public class PersonBl : IPersonBl
{
public PersonBl(ISomeMagicBl magicBl){...}
}
public class SomeMagicBl : ISomeMagicBl
{
public IPersonBl PersonBl { get; set; }
public SomeMagicBl(/*Other dependencies*/) {...}
}
我的模塊配置如下所示在我的課
...
builder.RegisterAssemblyTypes(ThisAssembly).Where(t => t.Name.EndsWith("BL")).AsImplementedInterfaces().PropertiesAutowired(PropertyWiringFlags.AllowCircularDependencies).InstancePerLifetimeScope();
...
可以看出,我有循環依賴我可以通過使用..PropertiesAutowired(PropertyWiringFlags.AllowCircularDependencies)..
來解決這個問題。
我的問題: 這個標誌在幕後做了什麼來解決這些循環依賴?
完美,thx。我認爲你應用了這樣的策略,只是想確保:) – Juri