External razor views can't see external models

后端 未结 2 1487
醉话见心
醉话见心 2021-01-29 05:27

I have a problem with external razor views. In my project I have main mvc web assembly and dynamically loaded external class library assemblies(from DB) with their own Controlle

相关标签:
2条回答
  • 2021-01-29 05:41

    Try use the using directive in your Views in the dynamic assembly.

    @using MyNamespace.MyPlugin.Models;
    @using MyNamespace.MyPlugin;
    

    etc

    0 讨论(0)
  • 2021-01-29 05:48

    I was able to precompile views with RazorGenerator Visual Studio extension (not RazorGenerator.Mvc one) in my assemblies.

    It basically converts .cshtml razor views into .cs files with WebViewPage classes before assemblies compile. And in my web project I had to implement my own VirtualPathProviderViewEngine similar to this one

    0 讨论(0)
提交回复
热议问题