官术网_书友最值得收藏!

Controllers and Actions

This chapter talks about arguably the most important feature of MVC: where the logic is stored. This is where you implement the stuff that your application does, where a substantial part of your business logic is.

Controllers and actions are found by convention and are called as the result of routing rules, which were introduced in the previous chapter. But things can get very complex—there are many ways by which an action can retrieve data from the request; it can be asynchronous or synchronous and it can return many different kinds of data. This data can be cached so that essentially there is no performance penalty in repeating the request.

As we know, HTTP is stateless, but that does not really play well with modern applications like the ones we're interested in, so we need to maintain the state between requests. We would alsolike to return data, numbers, and text according to the culture and language of the person that is issuing the request. We will look at all of these topics in the course of this chapter.

In this chapter, we will learn about the following topics:

  • How to use controllers
  • How controllers are found
  • What is the controller life cycle?
  • What are controller actions?
  • How to do error handling
  • How to cache responses
  • How to maintain the state between requests
  • Using dependency injection
  • Applying globalization and localization
主站蜘蛛池模板: 宜君县| 南宫市| 巴林右旗| 南平市| 江都市| 汶川县| 云安县| 平舆县| 遂川县| 武威市| 思南县| 德格县| 家居| 香格里拉县| 尼木县| 长丰县| 武鸣县| 威宁| 常州市| 开平市| 嘉黎县| 万安县| 寿宁县| 禄丰县| 多伦县| 崇仁县| 永平县| 延吉市| 喀喇| 洱源县| 修武县| 当涂县| 资中县| 江华| 昆明市| 屏南县| 乐陵市| 黄陵县| 盘锦市| 来凤县| 江油市|