随笔分类 - DotNETCore
摘要:.NET Core was released a few months ago, and data access libraries for most databases, both relational and NoSQL are now available. In this post, I’ll
阅读全文
摘要:APIDescriptionRequest bodyResponse body GET /api/todo Get all to-do items None Array of to-do items GET /api/todo/{id} Get an item by ID None To-do it
阅读全文
摘要:Razor Syntax Reference Implicit Razor expressions @DateTime.Now @DateTime.IsLeapYear(2016) @await DoSomething("hello", "world") Explicit Razor expressions Last week this time: @(DateTime.Now - TimeS...
阅读全文
摘要:Open Web Interface for .NET (OWIN) ------------------------------------------------------------------------- Running OWIN middleware in the ASP.NET pipeline "dependencies": { "Microsoft.AspNetCo...
阅读全文
摘要:Servers ASP.NET Core ships with two different HTTP servers: •Microsoft.AspNetCore.Server.Kestrel (AKA Kestrel, cross-platform) •Microsoft.AspNetCore.Server.WebListener (AKA WebListener, Windows-onl...
阅读全文
摘要:Application State Options --------------------------------------------------------------------- *HttpContext.Items app.Use(async (context, next) => { // perform some verification context.Item...
阅读全文
摘要:Model Binding Below is a list of model binding attributes: •[BindRequired]: This attribute adds a model state error if binding cannot occur. •[BindNever]: Tells the model binder to never bind to thi...
阅读全文
摘要:Hosting -------------------------------------------------------------------------- Setting up a Host : using Microsoft.AspNetCore.Hosting; public class Program { public static void Ma...
阅读全文
摘要:Dependency Injection ------------------------------------------------------------------------ ASP.NET services can be configured with the following lifetimes: Transient Transient lifetime services a...
阅读全文
摘要:Configuration var builder = new ConfigurationBuilder(); builder.AddInMemoryCollection(); var config = builder.Build(); config["somekey"] = "somevalue"; // do some other work var setting = config["...
阅读全文
摘要:Logging --------------------------------------------------------------------------------------- Implementing Logging in your Application var logger = loggerFactory.CreateLogger("Catchall Endpoint");...
阅读全文
摘要:Globalization and localization **************************************************************************************************** using Microsoft.AspNet.Localization; using Microsoft.AspNet.Mvc.Loc...
阅读全文
摘要:Error Handling public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseIISPlatformHandler(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPa...
阅读全文
摘要:Route ------------------------------------------constraint---------------------------------------------------- routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{i...
阅读全文
摘要:Application Startup Startup Constructor - IHostingEnvironment - ILoggerFactory ConfigureServices - IServiceCollection Configure - IApplicationBuilder - IHostingEnvironment - ILoggerFactory ------...
阅读全文

浙公网安备 33010602011771号