1
我怎麼能注入枚舉值成一個構造?Autofac注入枚舉
我的構造函數是:
public AutoComplete(SearchType searcherType, ISearchResultParser searchResultParser, string[] ignoreSearchTerms = null)
凡我搜索類型是:
public enum SearchType
{
Document,
PageSearch,
}
我Autofac登記:
builder.Register(x => new AutoComplete(SearchType.Document,
x.ResolveNamed<ISearchResultParser>(NamedAutofacInstances.AutoCompleteSearchResultParser),
invalidSearchTerms);
問:
執行枚舉的正確方法是什麼?
您的構造函數是自動完成但您註冊AutoCompleteForExamine。可以嗎? –
@AlexandrNikitin Thnx指出,這是錯字 – cpoDesign