我有以下内容:
interface IAncestor { }
interface IDescendant1 : IAncestor { }
interface IDescendant2 : IAncestor { }
class Descendant1 : IDescendant1 { }
class Descendant2 : IDescendant2 { }
我希望能够自动让 Castle Windsor 找到所有配对IDescendantX,DescendantX而无需我手动指定它们。这可能吗?
我试过了:
container.Register(
Classes.FromThisAssembly()
.BasedOn<IAncestor>()
.WithService.DefaultInterfaces()
.LifestyleTransient()
);
但这没有找到默认接口。(我在用正确的术语来表达我的问题时遇到了麻烦,所以找不到关于 SO 的话题已经回答了这个问题,抱歉,如果它是重复的......)