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: @notken, the fix we made as part of RazorGenerator.MsBuild \ Vsix v2.2.2 was to mangle names for EditorTemplates and DisplayTemplates. Consequently the names we generate are of the format * Paladin3_WebUI_Infrastructure_PaladinWebViewPage_Date* which avoids the name collision. We don't muck with the generic type parameter since it's the value specified via the @model declaration and prepending System to it all the time would not be the right behavior. The heuristic I"m using to figure out if something's a display \ editor template is by available here - https://razorgenerator.codeplex.com/SourceControl/changeset/9b78bbf75e334cbc95e86870d00255645ff1cda3#RazorGenerator.Core.v2/MvcViewTransformer.cs. It's likely that it might not be working correctly for your scenario. In which case, would you be able to provide a sample repro so we could fix our heuristic?
* 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: @notken, the fix we made as part of RazorGenerator.MsBuild \ Vsix v2.2.2 was to mangle names for EditorTemplates and DisplayTemplates. Consequently the names we generate are of the format * Paladin3_WebUI_Infrastructure_PaladinWebViewPage_Date* which avoids the name collision. We don't muck with the generic type parameter since it's the value specified via the @model declaration and prepending System to it all the time would not be the right behavior. The heuristic I"m using to figure out if something's a display \ editor template is by available here - https://razorgenerator.codeplex.com/SourceControl/changeset/9b78bbf75e334cbc95e86870d00255645ff1cda3#RazorGenerator.Core.v2/MvcViewTransformer.cs. It's likely that it might not be working correctly for your scenario. In which case, would you be able to provide a sample repro so we could fix our heuristic?