[英]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.) 我正在重建一个使用
.aspx
构建的小项目,我只是将其转换为Razor(通常-转换器不起作用。)
In the .aspx project
I have code-behind
a page & an auto-generated
file that start as follow: 在
.aspx project
我code-behind
页面和auto-generated
文件code-behind
有code-behind
如下:
//------------------------------------------------------------------------------
// <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
? 问题,我是否只创建一个新的控制器文件并添加
Code-behind
并忽略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. 在Windows窗体和Web窗体中,
designer.cs
仅用于可视设计器和窗体的组件。 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. 如果您要使用MVC,则该代码将无用,因为您将无法使用其中的任何代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.