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

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
主站蜘蛛池模板: 沙田区| 辉县市| 谷城县| 开远市| 平安县| 浙江省| 桃江县| 阿坝| 当阳市| 视频| 新和县| 左贡县| 岢岚县| 怀仁县| 兴仁县| 福州市| 府谷县| 施秉县| 科技| 乌拉特前旗| 盐边县| 托克托县| 冷水江市| 澄迈县| 历史| 容城县| 滨州市| 文昌市| 永宁县| 新乐市| 巍山| 枣庄市| 铁力市| 缙云县| 垦利县| 弥渡县| 潞西市| 佛山市| 平山县| 东乌珠穆沁旗| 邻水|