扩展Asp.NET MVC3控制器类 [英] Extending Asp.NET MVC3 Controller Class

查看:93
本文介绍了扩展Asp.NET MVC3控制器类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个相当有经验的程序员的.NET,以及一个MVC编程用PHP。现在我在MVC3,并试图建立其上我的第一个工作的新,所以我处理的几个问题。对于初学者来说,如何扩展控制器类?有人能指出我的指南/我应该实现方法列表?

I'm a fairly experienced .NET programmer, as well as a MVC programmer with PHP. Now I'm new at MVC3 and trying to build my first work on it, so I'm dealing with a few questions. For starters, how do I extend the Controller Class? Can someone point me to a guide/list of methods I should implement?

谢谢!

推荐答案

您没有实施任何的方法来延长控制器,虽然很明显这将是相当愚蠢不。你只是继承它,并覆盖你希望改变的方法。

You don't have to implement any methods to extend the controller, although obviously it would be rather silly not to. You just inherit from it, and override the methods you wish to alter.

如果你不知道改变了什么方法,我不得不怀疑你为什么要扩展它?

If you don't know what methods to alter, I have to question why you want to extend it?

编辑:

您可能会受益于两大MVC示例应用程序,Nerddiner和音乐商店。他们给你如何使电子商务网站一个很好的想法,并在MVC等。不把它们作为福音,因为它们是样品和旨在是简单。他们目前没有使用像依赖注入,或库设计的最佳实践。一些链接有用的教程:

You may benefit from the two big MVC sample applications, Nerddiner and Music Store. They give you a very good idea of how to make ecommerce sites and the like in MVC. Don't take them as gospel, because they are samples and are intended to be simple. They don't currently make use of best practices like Dependency Injection, or Repository design. Some links to useful tutorials:

这里好很多的视频。该Pluralsight东西是pretty直截了当

音乐商店教程应用

的NerdDinner教程

这篇关于扩展Asp.NET MVC3控制器类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆