Tag Helpers

The EnvironmentTagHelper can be used to include different scripts in your views (for example, raw or minified) based on the runtime environment, such as Development, Staring, or Production:

 <environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
</environment>

formating

 By default MVC includes a JsonInputFormatter class for handling JSON data, but you can add additional formatters for handling XML and other custom formats.可以添加其它的formatting.例如:

services.AddMvc()
.AddXmlSerializerFormatters();或者
services.AddMvc(options =>
{
options.OutputFormatters.Add(new XmlSerializerOutputFormatter());
});
 

Action可以返回一个对象,Controller actions can return POCOs (Plain Old CLR Objects), in which case ASP.NET MVC will automatically create an ObjectResult for you that wraps the object.

强制格式化返回数据:[Produces] filter

[Produces("application/json")]
public class AuthorsController

在url中定义数据格式:

 [FormatFilter]
public class ProductsController
{
[Route("[controller]/[action]/{id}.{format?}")]
public Product GetById(int id)

Response cache 

The primary HTTP header used for caching is Cache-Control. The HTTP 1.1 specification details many options for this directive. Three common directives are:

public
Indicates that the response may be cached.
private
        此种情况只能保存个人的缓存中,比如浏览器。
Indicates the response is intended for a single user and must not be cached by a shared cache. The response could still be cached in a private cache (for instance, by the user’s browser).
no-cache
Indicates the response must not be used by a cache to satisfy any subsequent request (without successful revalidation with the origin server).

aps.net cored 新概念的更多相关文章

  1. [新概念英语II 笔记] Lesson 3: Please Send Me a Card

    发现身边很多程序员都能看懂英文技术文章的60%-80%内容,但大家都有一个毛病,就是不会说,不会写作,在逛英文技术社区的时候,想发表点什么评论,总担心自己写的话有错误.究其原因, 我觉得主要原因是因为 ...

  2. 新概念英语(1-47)A cup of coffee

    新概念英语(1-47)A cup of coffee How does Ann like her coffee? A:Do you like coffee, Ann? B:Yes, I do. A:D ...

  3. 新概念英语(1-45)The boss's letter

    新概念英语(1-45)The boss's letter Why can't Pamela type the letter? A:Can you come here a minute, please, ...

  4. 新概念英语(1-43)Hurry up!

    新概念英语(1-43)Hurry up! How do you know Sam doesn't make the tea very often? A:Can you make the tea, Sa ...

  5. 新概念英语(1-41)Penny's bag

    新概念英语(1-41)Penny's bag Who is the tin of tobacco for? A:Is that bag heavy, Penny? B:Not very. A:Here ...

  6. 新概念英语(1-39)Don't drop it!

    新概念英语(1-39)Don't drop it! Where does Sam put the vase in the end ? A:What are you going to do with t ...

  7. 新概念英语(1-35)Our village

    新概念英语(1-35)Our village Are the children coming out of the park or going into it ? This is a photogra ...

  8. 新概念英语(1-32)A fine day

    新概念英语(1-33)A fine day Where is the Jones family? It is a fine day today. There are some clouds in th ...

  9. 新概念英语(1-31)Where's Sally?

    新概念英语(1-31)Where's Sally? Is the cat climbing the tree ? A:Where is Sally, Jack ? B:She is in the ga ...

随机推荐

  1. CSS 实现背景透明 内容文字不透明 显示

    思路主要是 IE9+ 谷歌 火狐等使用rgba(0,0,0,0.5)来确定透明度 前三个值是RGB值 可以直接参考PS里对应的值 最后一个是透明度 例子 background:rgba(255,255 ...

  2. [nosql之redis]yum安装redis

    1.首先对于这种nosql来说目前我用到的功能很少,所以感觉没有必要去优化他跟不需要去编译安装.今天来介绍下一个yum安装redis 步骤1:安装扩展yum库 [root@localhost ~]# ...

  3. [Math] 常见的几种最优化方法

    我们每个人都会在我们的生活或者工作中遇到各种各样的最优化问题,比如每个企业和个人都要考虑的一个问题“在一定成本下,如何使利润最大化”等.最优化方法是一种数学方法,它是研究在给定约束之下如何寻求某些因素 ...

  4. PHP函数call_user_func和call_user_func_array详解

    今天在群里面,有个叫lewis的在问call_user_func_array的用法,因为之前一直没有用过,也不能说什么,于是看一下手册,发现是这么写的: call_user_func_array (P ...

  5. C和指针 第五章 习题

    下列输出的值: #include <stdio.h> int func(){ static int count = 1; return ++count; } int main() { in ...

  6. css3径向渐变详解-遁地龙卷风

    (-1)写在前面 我用的是chrome49,如果你用的不是.可以尝试换下浏览器前缀.IE在这方面的实现又特例独行了.不想提及-,这篇是为后续做准备. (0)快速使用 background-image: ...

  7. WPF 线程 Dispatcher

    WPF 应用程序从两个线程开始: 一个用于处理呈现 一个用于管理 UI 呈现线程有效地隐藏在后台运行,而UI线程则接收输入.处理事件.绘制屏幕以及运行应用程序代码. 大多数应用程序都使用一个 UI 线 ...

  8. .NET LINQ标准查询运算符

    标准查询运算符概述      “标准查询运算符”是组成语言集成查询 (LINQ) 模式的方法. 大多数这些方法都在序列上运行,其中的序列是一个对象,其类型实现了 IEnumerable<T> ...

  9. iOS 图形处理 Core Graphics Quartz2D 教程

    Core Graphics Framework是一套基于C的API框架,使用了Quartz作为绘图引擎.它提供了低级别.轻量级.高保真度的2D渲染.该框架可以用于基于路径的 绘图.变换.颜色管理.脱屏 ...

  10. (转)Oracle 获取上周一到周末日期的查询sql语句

    -- Oracle 取上周一到周末的sql -- 这样取的是 在一周内第几天,是以周日为开始的 select to_char(to_date('20130906','yyyymmdd'),'d') f ...