开发者

How to set priority of interface implementation in Orchard?

开发者 https://www.devze.com 2023-02-16 13:48 出处:网络
I\'d like to create a custom INavigationProvider in my modul开发者_运维知识库e for Orchard CMS:

I'd like to create a custom INavigationProvider in my modul开发者_运维知识库e for Orchard CMS:

[UsedImplicitly]
LocalizedMainMenuNavigationProvider : INavigationProvider

But it seems that my implementation is not used by the IoC container (AutoFac I think), probably because there is already another module installed that provides an implementation that is used.

How can I enforce Orchard to use my implementation?

Thanks


Menu is built by INavigationManager, which takes an IEnumerable< INavigationProvider > as a parameter. It means that it takes all providers for a given menu name and merges their outputs. And this data is used to render the final menu.

Also make sure that your class is public - otherwise your implementation won't be registered.

If I were you I'd rather create a custom implementation of INavigationManager based on the default one (so not to copy/paste all the code). This is the only place where you get all menu items gathered from providers and are able to localize them.

HTH

0

精彩评论

暂无评论...
验证码 换一张
取 消