![](/img/trans.png)
[英]Castle Windsor: Auto-register types from one assembly that implement interfaces from another
[英]Register types from Assembly in Windsor Castle with 'where' predicate
我對如何實現滿足以下條件的注冊感到困惑:
我使用以下方法,但是我不明白在哪里放置“ where”類型是子句:
private BasedOnDescriptor CreateDescriptor<TInterface>(Predicate<Type> accepted)
{
return Classes
.FromAssemblyContaining<TInterface>()
.IncludeNonPublicTypes()
.Where(Component.IsInSameNamespaceAs<TInterface>())
.WithService.AllInterfaces()
.WithService.Self();
}
'accepted'子句應指出應使用的類型名稱。謝謝。
.If(t => t.Name.EndsWith("Adapter"))
然而,把如何不談,它可能是類型分成自己的命名空間,用於建築的清晰度是一個好主意。 副作用是,您不需要額外的過濾謂詞。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.