Quantcast
Channel: RazorGenerator Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 525

Commented Issue: EditorTemplates and DisplayTemplates are broken due to namespace mangling [133]

$
0
0
As addressed in the following discussions
* https://razorgenerator.codeplex.com/discussions/471355
* https://razorgenerator.codeplex.com/discussions/278608

RazorGenerator runs into issues with EditorTemplates and DisplayTemplates where users end up having to fully qualify types in the template files for it to work correctly. The problem is with the way RazorGenerator differs in the generation of names compared to the Asp.Net build provider.

For a file named at ~\Views\Shared\Boolean.cshtml, the build provider generates file names of the format
namespace ASP {
_Page_Views_Shared_Boolean_cshtml : WebViewPage<Boolean?>

}

versus RazorGenerator's output looks like
namespace Views.Shared
{
public class Boolean : WebViewPage<Boolean?>
}

which results in the cs compiler incorrectly inferring the templated Boolean type.


Comments: I can't seem to recreate the issue in a new project, so heaven knows what the cause of it is. Sorry I've not been able to help (and maybe there's nothing wrong with RazorGenerator!) But I have now got it working on my project. In the end I only had to make a couple of changes, to fully qualify a couple of clashing model names. I actually have my own View Engine for this project (I need to also check some custom locations), so I've amended it to inherit from yours. Is there a way you recommend to test that it is using the code rather than the cshtml files? I've tried renaming or deleting the original, without recompiling, but I still get a "The view 'Index' or its master was not found" error. Is that expected, or should the pre-compiled version existing preclude that check? I just don't know if it's working or not! Many thanks.

Viewing all articles
Browse latest Browse all 525

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>