MVC ASP.NET or Razor

后端 未结 4 514
清歌不尽
清歌不尽 2021-02-05 11:07

I\'m very new to MVC...I have quite a bit of knowledge with Silver-light and WPF and MVVM but little knowledge in regards to MVC. I\'m following along the main tutorial on Micr

相关标签:
4条回答
  • 2021-02-05 11:12

    Razor is a Microsoft internal extension to ASP.NET MVC. You seem to be under the impression that Razor is provided by the community or is an off-shoot of the MVC base components, which is entirely false. Razor also provides syntactically cleaner code than ASPX.

    0 讨论(0)
  • 2021-02-05 11:23

    The "extra third party dlls or code" you would be relying on are well established and absolutely no brainers to include. You copy it once and forget about it. It's not like you have to hunt them down, either. It's very easy Xcopy deployment.

    As you have seen, the MS MVC site uses Razor. Most (all?) of the sites and books I read are using Razor.

    Use Razor, and you'll find a lot more help than with aspx in MVC.

    0 讨论(0)
  • 2021-02-05 11:31

    There is no difference regarding dependencies on 3rd party anything. ASPX is fine, but Razor is better, mostly because it stays out of your way.

    You should read Scott Guthrie's blog post Introducing "Razor".

    You basically replace the opening and closing tags <% and %> with an @ symbol, so far fewer keystrokes to do the same thing, i.e.

    <%: Model.UserName %>

    becomes

    @Model.UserName

    and

    <% foreach (string name in nameList) { .. } %>

    becomes

    @foreach (string name in nameList) { .. }

    There's a little more to it than that, but not much.

    0 讨论(0)
  • 2021-02-05 11:37

    Razor is the sloppiest possible thing you could do to your markup. Code and markup do not belong in the same file, period. It is totally beyond me how anyone could recommend such madness.

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