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

Summary

In this chapter, we saw that using POCO controllers is not really needed, and it requires more work than whatever benefit we can take out of it, so we should have our controllers inherit from Controller.

Then we saw that using asynchronous actions is good for improved scalability as it won't affect performance much, but your app will be more responsive.

You can forget about XML formatting, as JSON works perfectly, and is the standard way to send and process data on the web.

We learned that we should use POCO classes as the model for our actions. The built-in model binders work well, as we'll see in upcoming chapters, but you can add the cookie value provider as it may come in handy.

As far as model validation is concerned, we saw that it is better to stick to the good old data annotations API. If necessary, you should implement IValidatableObject in your model.

The Redis distributed cache system is very popular and is supported by both Azure and AWS. Redis should be your choice for a distributed cache to keep reference data; in other words, stuff that isn't changed often.

Performance-wise, response caching is also useful. The products page shouldn't change that much, so at least we can keep it in the cache for a few hours.

This was a long chapter where we covered controllers and actions, arguably the most important aspects of ASP.NET Core. We also covered parts of the model concept, such as binding, injection, and validation. We saw how we can maintain the state and the possible values that we can return from an action. We also learned how to use resources for translation purposes. Some of these concepts will be revisited in future chapters; in the next one, we will be talking about views.

主站蜘蛛池模板: 城固县| 广昌县| 新龙县| 卫辉市| 安义县| 同心县| 房产| 林甸县| 海伦市| 长丰县| 吉安市| 东乌珠穆沁旗| 同德县| 德惠市| 调兵山市| 石楼县| 彰化市| 独山县| 电白县| 锦州市| 衡东县| 长宁县| 西贡区| 五峰| 云霄县| 杭锦旗| 奈曼旗| 永新县| 无极县| 龙州县| 锡林郭勒盟| 惠水县| 南江县| 孟连| 荆州市| 鄢陵县| 宜兴市| 遂溪县| 大庆市| 全州县| 望都县|