net-core理解

环境:net core 7.0

第一行代码:

var builder = WebApplication.CreateBuilder(args); // 1 忘记了Application,创建ApplicationBuilder Microsoft.AspNetCore.Builder

 第二行代码:

builder.Services.AddControllers();
private static IMvcCoreBuilder AddControllersCore(IServiceCollection services)
{
// This method excludes all of the view-related services by default.
var builder = services
.AddMvcCore()
.AddApiExplorer()
.AddAuthorization()
.AddCors()
.AddDataAnnotations()
.AddFormatterMappings();
 
if (MetadataUpdater.IsSupported)
{
services.TryAddEnumerable(
ServiceDescriptor.Singleton<IActionDescriptorChangeProvider, HotReloadService>());
}
 
return builder;
}

 

posted @ 2023-05-14 14:52  vba是最好的语言  阅读(10)  评论(0编辑  收藏  举报