public interface IMySpecialService {}
public interface MySpecialService : IMySpecialService {}
是否可以将MySpecialService
注册为IMySpecialService
的所选实现,而无需指定接口或实现的详细信息?即我可以将Castle Windsor配置为使用接口名称减去I
吗?
答案 0 :(得分:2)
这个应该适合你:
container.Register(
Classes.FromThisAssembly()
.InNamespace("YourNamespace")
.WithService.DefaultInterfaces()
);
更多信息:
https://github.com/castleproject/Windsor/blob/master/docs/registering-components-by-conventions.md