简体   繁体   中英

Code-behind in MVC

I'm rebuilding a small project which is built using .aspx , i'm simply converting it to Razor(manually - converters do not work.)

In the .aspx project I have code-behind a page & an auto-generated file that start as follow:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated. 
// </auto-generated>
//------------------------------------------------------------------------------

Question, do I just create a new controller file and add the Code-behind and ignore the auto-generated file ? I'd really appreciate your guidance!

Short answer: yes.

In Windows Forms and Web Forms, the designer.cs are only there for the visual designer and the components of the form. If you are moving to MVC, there is no use for any of that code since you will not be able to use anything from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM