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

Commented Issue: MSBuild task fails when Model name same as partial name [38]

$
0
0
Models\AccountForm.cs
public class AccountForm {
public string Name {get;set;}
}

Views\Shared\EditorTemplates\AccountForm.cshtml
@using Web.Models;
@model AccountForm

<p>
@Html.TextBoxFor(m => m.Name)
</p>

Will generate cs like
using Web.Models;
public class AccountForm : System.Web.Mvc.WebViewPage<AccountForm> {

}

And then it doesn't know which account form to use.

Can workaround by changing view to remove using and have
@model Web.Models.AccountForm


Comments: Most of these issues stem from us preferring to mangle names in a different way than how Mvc does it. For instance, Mvc generates type names which look like ``` namespace Asp { public class Views_Home__Partial_cshtml : WebViewPage ``` versus the names we generate look like ``` namespace Views.Home { public class Partial : WebViewPage ``` The primary incentive for doing this is to allow for cleaner types when using RazorGenerator.Testing. Given that this keeps throwing people off, it might be worthwhile to consider making this "cleaner" name generation an optional switch. @davidebbo, thoughts?

Viewing all articles
Browse latest Browse all 525

Trending Articles



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