随笔 - 65  文章 - 0 评论 - 585 trackbacks - 3

最全的 demo

https://github.com/XiaoFaye/netcore-samples

http://files.cnblogs.com/files/kellynic/practical-aspnetcore-master.zip

--------------------------------

.net core markdown 转换

"CommonMark.Net" : "0.13.4"

--------------------------------

.net core 国际区域化,做多国语言版有用

"Microsoft.AspNetCore.Localization": "1.1.0",
"Microsoft.Extensions.Localization" : "1.1.0"

--------------------------------

.net core 退出程序时有用,IApplicationLifetime

public void Configure(IApplicationBuilder app, IApplicationLifetime lifetime)
{
lifetime.ApplicationStarted.Register(() => System.Console.WriteLine("===== Server is starting"));
lifetime.ApplicationStopping.Register(() => System.Console.WriteLine("===== Server is stopping"));
lifetime.ApplicationStopped.Register(() => System.Console.WriteLine("===== Server has stopped"));

--------------------------------

.net core 获取平台环境信息

"Microsoft.Extensions.PlatformAbstractions" : "1.1.0-*"

--------------------------------

.net core 循环 form 表单值

var form = await context.Request.ReadFormAsync();

for (var k in form.Keys)

--------------------------------

.net core 获取上传文件

var form = await context.Request.ReadFormAsync();

for (var f in form.Files)

--------------------------------

.net core 读取 xml 配置

"Microsoft.Extensions.Configuration.Xml" : "1.1.0",

--------------------------------

.net core 读取 ini 配置

"Microsoft.Extensions.Configuration.INI" : "1.1.0",

--------------------------------

.net core 重定向,正则

"Microsoft.AspNetCore.Rewrite" : "1.0.0-*",

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory logger)
{
var options = new RewriteOptions()
.AddRedirect("([/_0-9a-z-]+)+(.*)$", "/?path=$1&ext=$2"); //redirect any path that ends with .html

app.UseRewriter(options);

--------------------------------

.net core 日志Serilog

"Serilog.Extensions.Logging": "1.0.0-rc2-10110",
"Serilog.Sinks.File": "2.0.0-rc-706"

--------------------------------

.net core mvc测试

MyTested.AspNetCore.Mvc

--------------------------------

.netcore razor模板引擎渲染
https://github.com/toddams/RazorLight

--------------------------------

.net core 图片,验证码

https://github.com/JimBobSquarePants/ImageSharp

https://github.com/dlemstra/Magick.NET

--------------------------------

.net core 二维码,linux环境下需先安装 apt-get install libgdiplus

Gma.QrCodeNet.Encoding

posted on 2017-02-24 16:03 nicye 阅读(...) 评论(...) 编辑 收藏