ASP.NET Core学习笔记3

 

 

 

 

 

jQuery扩展方法

方法

含义

示例

jQuery.extend(object);

为扩展jQuery类本身.为类添加新的方法。 1.合并多个对象。2.深度嵌套对象。

jQuery.fn.myPlugin = function(options) {
$options = $.extend( { html: "no messages",
css: { "color": "red", "font-size":"14px"}}, options);
return $(this).css({ "color": $options.css.color, }).html($options.html); }

jQuery.fn.extend(object);

给jQuery对象添加方法。

$.extend({
add:function(a,b){return a+b;},
minus:function(a,b){return a-b},
multiply:function(a,b){return a*b;},
divide:function(a,b){return Math.floor(a/b);}
});
var sum = $.add(3,5)+$.minus(3,5)+$.multiply(3,5)+$.divide(5,7);

@RenderBody、@RenderPage、@RenderSection

 

@RenderBody

布局页(_Layout.cshtml)通过占位符@RenderBody占用独立部分,当创建基于此布局页的试图时,视图的内容会和布局页合并,而新创建的视图内容会通过布局页的@ReanderBody方法呈现在Body之间。

此方法不需要参数,且只能出现一次

@RenderBody()就相当于占位符,将视图页的内容展示在此

<body>
<div id="header">@{Html.RenderAction("Menu", "Global");}</div>
<div id="sideBar">
@RenderSection("SubMenu",false)
</div>
<div id="container">@RenderBody()</div>
<div id="footer">@{Html.RenderAction("Footer", "Global");}</div>
</body>
@{ViewBag.Title = "About";}
 
@section SubMenu{Hello This is a section implement in About View.}

 

@RenderPage

要引用呈现的视图,如网站头部、底部可单独放在一个共享的视图文件夹中,然后在布局页中使用@RenderPage方法来引用

@RenderPage("~/Views/Shared/_Header.cshtml")
@RenderBody()
@RenderPage("~/Views/Shared/_Bottom.cshtml")

@RenderSection

@RenderSection就是在Layout布局页中定义了分段,留给使用该布局页的视图来实现。@Rendersection提供两个参数。

 

@RenderSection("head"),则表示视图中必须实现,否则会报异常错误。

      @RenderSection("head", required: true),则表示视图中也必须实现,否则会报异常错误。

      @RenderSection("head", required: false),则表示视图中可实现或不实现。

      RenderSection实现默认内容:

@if (IsSectionDefined("head"))

{  @RenderSection("head", false);}

else{  <p>head的默认内容</p>}

 @IsSectionDefined是判断某个分段是否存在,如果存在就输出,否则输出默认内容。

在视图页中的实现方式:

@section head{........}

揭秘IServiceCollection,竟然多达186项服务

IServiceCollection 中的内容如下:
index=0,service=ServiceType: Microsoft.AspNetCore.Hosting.WebHostOptions Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore.Hosting.WebHostOptions
index=1,service=ServiceType: Microsoft.AspNetCore.Hosting.IWebHostEnvironment Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore.Hosting.HostingEnvironment
index=2,service=ServiceType: Microsoft.Extensions.Hosting.IHostEnvironment Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore.Hosting.HostingEnvironment
index=3,service=ServiceType: Microsoft.AspNetCore.Hosting.IHostingEnvironment Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore.Hosting.HostingEnvironment
index=4,service=ServiceType: Microsoft.Extensions.Hosting.IHostingEnvironment Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore.Hosting.HostingEnvironment
index=5,service=ServiceType: Microsoft.AspNetCore.Hosting.WebHostBuilderContext Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore.Hosting.WebHostBuilderContext
index=6,service=ServiceType: Microsoft.Extensions.Configuration.IConfiguration Lifetime: Singleton ImplementationFactory: Microsoft.Extensions.Configuration.IConfiguration <BuildCommonServices>b__0(System.IServiceProvider)
index=7,service=ServiceType: Microsoft.AspNetCore.Hosting.Builder.IApplicationBuilderFactory Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Hosting.Builder.ApplicationBuilderFactory
index=8,service=ServiceType: Microsoft.AspNetCore.Http.IHttpContextFactory Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Http.DefaultHttpContextFactory
index=9,service=ServiceType: Microsoft.AspNetCore.Http.IMiddlewareFactory Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Http.MiddlewareFactory
index=10,service=ServiceType: Microsoft.Extensions.Options.IOptions`1[TOptions] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Options.OptionsManager`1[TOptions]
index=11,service=ServiceType: Microsoft.Extensions.Options.IOptionsSnapshot`1[TOptions] Lifetime: Scoped ImplementationType: Microsoft.Extensions.Options.OptionsManager`1[TOptions]
index=12,service=ServiceType: Microsoft.Extensions.Options.IOptionsMonitor`1[TOptions] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Options.OptionsMonitor`1[TOptions]
index=13,service=ServiceType: Microsoft.Extensions.Options.IOptionsFactory`1[TOptions] Lifetime: Transient ImplementationType: Microsoft.Extensions.Options.OptionsFactory`1[TOptions]
index=14,service=ServiceType: Microsoft.Extensions.Options.IOptionsMonitorCache`1[TOptions] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Options.OptionsCache`1[TOptions]
index=15,service=ServiceType: Microsoft.Extensions.Logging.ILoggerFactory Lifetime: Singleton ImplementationType: Microsoft.Extensions.Logging.LoggerFactory
index=16,service=ServiceType: Microsoft.Extensions.Logging.ILogger`1[TCategoryName] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Logging.Logger`1[T]
index=17,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.Extensions.Logging.LoggerFilterOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Logging.DefaultLoggerLevelConfigureOptions
index=18,service=ServiceType: Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfigurationFactory Lifetime: Singleton ImplementationType: Microsoft.Extensions.Logging.Configuration.LoggerProviderConfigurationFactory
index=19,service=ServiceType: Microsoft.Extensions.Logging.Configuration.ILoggerProviderConfiguration`1[T] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Logging.Configuration.LoggerProviderConfiguration`1[T]
index=20,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.Extensions.Logging.LoggerFilterOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Logging.LoggerFilterConfigureOptions
index=21,service=ServiceType: Microsoft.Extensions.Options.IOptionsChangeTokenSource`1[Microsoft.Extensions.Logging.LoggerFilterOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Options.ConfigurationChangeTokenSource`1[Microsoft.Extensions.Logging.LoggerFilterOptions]
index=22,service=ServiceType: Microsoft.Extensions.Logging.Configuration.LoggingConfiguration Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Logging.Configuration.LoggingConfiguration
index=23,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Logging.Configuration.LoggerProviderConfigureOptions`2[Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions,Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider]
index=24,service=ServiceType: Microsoft.Extensions.Options.IOptionsChangeTokenSource`1[Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Logging.Configuration.LoggerProviderOptionsChangeTokenSource`2[Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions,Microsoft.Extensions.Logging.Console.ConsoleLoggerProvider]
index=25,service=ServiceType: Microsoft.Extensions.Logging.EventSource.LoggingEventSource Lifetime: Singleton ImplementationInstance: EventSource(Microsoft-Extensions-Logging, 3ac73b97-af73-50e9-0822-5da4367920d0)
index=26,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.Extensions.Logging.LoggerFilterOptions] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Logging.EventLogFiltersConfigureOptions
index=27,service=ServiceType: Microsoft.Extensions.Options.IOptionsChangeTokenSource`1[Microsoft.Extensions.Logging.LoggerFilterOptions] Lifetime: Singleton ImplementationType: Microsoft.Extensions.Logging.EventLogFiltersConfigureOptionsChangeSource
index=28,service=ServiceType: Microsoft.Extensions.DependencyInjection.IServiceProviderFactory`1[Microsoft.Extensions.DependencyInjection.IServiceCollection] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.DependencyInjection.DefaultServiceProviderFactory
index=29,service=ServiceType: Microsoft.AspNetCore.Connections.IConnectionListenerFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.SocketTransportFactory
index=30,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions] Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Server.Kestrel.Core.Internal.KestrelServerOptionsSetup
index=31,service=ServiceType: Microsoft.AspNetCore.Hosting.Server.IServer Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer
index=32,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Options.ConfigureNamedOptions`1[Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions]
index=33,service=ServiceType: Microsoft.Extensions.Options.IPostConfigureOptions`1[Microsoft.AspNetCore.HostFiltering.HostFilteringOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Options.PostConfigureOptions`1[Microsoft.AspNetCore.HostFiltering.HostFilteringOptions]
index=34,service=ServiceType: Microsoft.Extensions.Options.IOptionsChangeTokenSource`1[Microsoft.AspNetCore.HostFiltering.HostFilteringOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Options.ConfigurationChangeTokenSource`1[Microsoft.AspNetCore.HostFiltering.HostFilteringOptions]
index=35,service=ServiceType: Microsoft.AspNetCore.Hosting.IStartupFilter Lifetime: Transient ImplementationType: Microsoft.AspNetCore.HostFilteringStartupFilter
index=36,service=ServiceType: Microsoft.AspNetCore.Routing.IInlineConstraintResolver Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Routing.DefaultInlineConstraintResolver
index=37,service=ServiceType: Microsoft.Extensions.ObjectPool.ObjectPoolProvider Lifetime: Transient ImplementationType: Microsoft.Extensions.ObjectPool.DefaultObjectPoolProvider
index=38,service=ServiceType: Microsoft.Extensions.ObjectPool.ObjectPool`1[Microsoft.AspNetCore.Routing.UriBuildingContext] Lifetime: Singleton ImplementationFactory: Microsoft.Extensions.ObjectPool.ObjectPool`1[Microsoft.AspNetCore.Routing.UriBuildingContext] <AddRouting>b__0_0(System.IServiceProvider)
index=39,service=ServiceType: Microsoft.AspNetCore.Routing.Tree.TreeRouteBuilder Lifetime: Transient ImplementationFactory: Microsoft.AspNetCore.Routing.Tree.TreeRouteBuilder <AddRouting>b__0_1(System.IServiceProvider)
index=40,service=ServiceType: Microsoft.AspNetCore.Routing.RoutingMarkerService Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.RoutingMarkerService
index=41,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Routing.RouteOptions] Lifetime: Transient ImplementationFactory: Microsoft.Extensions.DependencyInjection.ConfigureRouteOptions <AddRouting>b__2(System.IServiceProvider)
index=42,service=ServiceType: Microsoft.AspNetCore.Routing.EndpointDataSource Lifetime: Singleton ImplementationFactory: Microsoft.AspNetCore.Routing.EndpointDataSource <AddRouting>b__3(System.IServiceProvider)
index=43,service=ServiceType: Microsoft.AspNetCore.Routing.ParameterPolicyFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.DefaultParameterPolicyFactory
index=44,service=ServiceType: Microsoft.AspNetCore.Routing.Matching.MatcherFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.Matching.DfaMatcherFactory
index=45,service=ServiceType: Microsoft.AspNetCore.Routing.Matching.DfaMatcherBuilder Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Routing.Matching.DfaMatcherBuilder
index=46,service=ServiceType: Microsoft.AspNetCore.Routing.Internal.DfaGraphWriter Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.Internal.DfaGraphWriter
index=47,service=ServiceType: Microsoft.AspNetCore.Routing.Matching.DataSourceDependentMatcher+Lifetime Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Routing.Matching.DataSourceDependentMatcher+Lifetime
index=48,service=ServiceType: Microsoft.AspNetCore.Routing.Matching.EndpointMetadataComparer Lifetime: Singleton ImplementationFactory: Microsoft.AspNetCore.Routing.Matching.EndpointMetadataComparer <AddRouting>b__0_4(System.IServiceProvider)
index=49,service=ServiceType: Microsoft.AspNetCore.Routing.LinkGenerator Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.DefaultLinkGenerator
index=50,service=ServiceType: Microsoft.AspNetCore.Routing.IEndpointAddressScheme`1[System.String] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.EndpointNameAddressScheme
index=51,service=ServiceType: Microsoft.AspNetCore.Routing.IEndpointAddressScheme`1[Microsoft.AspNetCore.Routing.RouteValuesAddress] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.RouteValuesAddressScheme
index=52,service=ServiceType: Microsoft.AspNetCore.Routing.LinkParser Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.DefaultLinkParser
index=53,service=ServiceType: Microsoft.AspNetCore.Routing.Matching.EndpointSelector Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.Matching.DefaultEndpointSelector
index=54,service=ServiceType: Microsoft.AspNetCore.Routing.MatcherPolicy Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.Matching.HttpMethodMatcherPolicy
index=55,service=ServiceType: Microsoft.AspNetCore.Routing.MatcherPolicy Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.Matching.HostMatcherPolicy
index=56,service=ServiceType: Microsoft.AspNetCore.Routing.Template.TemplateBinderFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.Template.DefaultTemplateBinderFactory
index=57,service=ServiceType: Microsoft.AspNetCore.Routing.Patterns.RoutePatternTransformer Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Routing.Patterns.DefaultRoutePatternTransformer
index=58,service=ServiceType: Microsoft.AspNetCore.Hosting.IStartup Lifetime: Singleton ImplementationFactory: System.Object <UseStartup>b__1(System.IServiceProvider)
index=59,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.Extensions.Logging.LoggerFilterOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Logging.DefaultLoggerLevelConfigureOptions
index=60,service=ServiceType: Microsoft.Extensions.Logging.ILoggerProvider Lifetime: Singleton ImplementationFactory: NLog.Extensions.Logging.NLogLoggerProvider <AddNLogLoggerProvider>b__0(System.IServiceProvider)
index=61,service=ServiceType: Microsoft.AspNetCore.Http.IHttpContextAccessor Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Http.HttpContextAccessor
index=62,service=ServiceType: System.Diagnostics.DiagnosticListener Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore
index=63,service=ServiceType: System.Diagnostics.DiagnosticSource Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore
index=64,service=ServiceType: Microsoft.AspNetCore.Hosting.ApplicationLifetime Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Hosting.ApplicationLifetime
index=65,service=ServiceType: Microsoft.Extensions.Hosting.IHostApplicationLifetime Lifetime: Singleton ImplementationFactory: Microsoft.Extensions.Hosting.IHostApplicationLifetime <.ctor>b__20_0(System.IServiceProvider)
index=66,service=ServiceType: Microsoft.AspNetCore.Hosting.IApplicationLifetime Lifetime: Singleton ImplementationFactory: Microsoft.AspNetCore.Hosting.IApplicationLifetime <.ctor>b__20_1(System.IServiceProvider)
index=67,service=ServiceType: Microsoft.Extensions.Hosting.IApplicationLifetime Lifetime: Singleton ImplementationFactory: Microsoft.Extensions.Hosting.IApplicationLifetime <.ctor>b__20_2(System.IServiceProvider)
index=68,service=ServiceType: Microsoft.AspNetCore.Hosting.HostedServiceExecutor Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Hosting.HostedServiceExecutor
index=69,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Options.ConfigureNamedOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions]
index=70,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorOptions] Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.ConfigureSwaggerGeneratorOptions
index=71,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorOptions] Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.ConfigureSchemaGeneratorOptions
index=72,service=ServiceType: Swashbuckle.AspNetCore.Swagger.ISwaggerProvider Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator
index=73,service=ServiceType: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorOptions Lifetime: Transient ImplementationFactory: Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorOptions <AddSwaggerGen>b__0_1(System.IServiceProvider)
index=74,service=ServiceType: Swashbuckle.AspNetCore.SwaggerGen.ISchemaGenerator Lifetime: Transient ImplementationType: Swashbuckle.AspNetCore.SwaggerGen.SchemaGenerator
index=75,service=ServiceType: Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorOptions Lifetime: Transient ImplementationFactory: Swashbuckle.AspNetCore.SwaggerGen.SchemaGeneratorOptions <AddSwaggerGen>b__0_2(System.IServiceProvider)
index=76,service=ServiceType: Swashbuckle.AspNetCore.SwaggerGen.ISerializerDataContractResolver Lifetime: Transient ImplementationFactory: Swashbuckle.AspNetCore.SwaggerGen.ISerializerDataContractResolver <AddSwaggerGen>b__0_3(System.IServiceProvider)
index=77,service=ServiceType: Microsoft.Extensions.ApiDescriptions.IDocumentProvider Lifetime: Singleton ImplementationType: Microsoft.Extensions.ApiDescriptions.DocumentProvider
index=78,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Options.ConfigureNamedOptions`1[Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenOptions]
index=79,service=ServiceType: Microsoft.AspNetCore.Cors.Infrastructure.ICorsService Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Cors.Infrastructure.CorsService
index=80,service=ServiceType: Microsoft.AspNetCore.Cors.Infrastructure.ICorsPolicyProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Cors.Infrastructure.DefaultCorsPolicyProvider
index=81,service=ServiceType: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager Lifetime: Singleton ImplementationInstance: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager
index=82,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions] Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.MvcCoreMvcOptionsSetup
index=83,service=ServiceType: Microsoft.Extensions.Options.IPostConfigureOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions] Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.MvcOptionsConfigureCompatibilityOptions
index=84,service=ServiceType: Microsoft.Extensions.Options.IPostConfigureOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions] Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.MvcCoreMvcOptionsSetup
index=85,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Mvc.ApiBehaviorOptions] Lifetime: Transient ImplementationType: Microsoft.Extensions.DependencyInjection.ApiBehaviorOptionsSetup
index=86,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Routing.RouteOptions] Lifetime: Transient ImplementationType: Microsoft.Extensions.DependencyInjection.MvcCoreRouteOptionsSetup
index=87,service=ServiceType: Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.ApplicationModels.ApplicationModelFactory
index=88,service=ServiceType: Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultApplicationModelProvider
index=89,service=ServiceType: Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.ApplicationModels.ApiBehaviorApplicationModelProvider
index=90,service=ServiceType: Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.ApplicationModels.ControllerActionDescriptorProvider
index=91,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionDescriptorCollectionProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider
index=92,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionSelector Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ActionSelector
index=93,service=ServiceType: Microsoft.AspNetCore.Mvc.ActionConstraints.ActionConstraintCache Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.ActionConstraints.ActionConstraintCache
index=94,service=ServiceType: Microsoft.AspNetCore.Mvc.ActionConstraints.IActionConstraintProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.ActionConstraints.DefaultActionConstraintProvider
index=95,service=ServiceType: Microsoft.AspNetCore.Routing.MatcherPolicy Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.ConsumesMatcherPolicy
index=96,service=ServiceType: Microsoft.AspNetCore.Routing.MatcherPolicy Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.ActionConstraintMatcherPolicy
index=97,service=ServiceType: Microsoft.AspNetCore.Mvc.Controllers.IControllerFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerFactory
index=98,service=ServiceType: Microsoft.AspNetCore.Mvc.Controllers.IControllerActivator Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerActivator
index=99,service=ServiceType: Microsoft.AspNetCore.Mvc.Controllers.IControllerFactoryProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider
index=100,service=ServiceType: Microsoft.AspNetCore.Mvc.Controllers.IControllerActivatorProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider
index=101,service=ServiceType: Microsoft.AspNetCore.Mvc.Controllers.IControllerPropertyActivator Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Controllers.DefaultControllerPropertyActivator
index=102,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionInvokerFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ActionInvokerFactory
index=103,service=ServiceType: Microsoft.AspNetCore.Mvc.Abstractions.IActionInvokerProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerProvider
index=104,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerCache Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvokerCache
index=105,service=ServiceType: Microsoft.AspNetCore.Mvc.Filters.IFilterProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Filters.DefaultFilterProvider
index=106,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultTypeMapper Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ActionResultTypeMapper
index=107,service=ServiceType: Microsoft.AspNetCore.Mvc.Filters.RequestSizeLimitFilter Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Filters.RequestSizeLimitFilter
index=108,service=ServiceType: Microsoft.AspNetCore.Mvc.Filters.DisableRequestSizeLimitFilter Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Filters.DisableRequestSizeLimitFilter
index=109,service=ServiceType: Microsoft.AspNetCore.Mvc.Filters.RequestFormLimitsFilter Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Filters.RequestFormLimitsFilter
index=110,service=ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadataProvider
index=111,service=ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.ICompositeMetadataDetailsProvider Lifetime: Transient ImplementationFactory: Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.ICompositeMetadataDetailsProvider <AddMvcCoreServices>b__5_0(System.IServiceProvider)
index=112,service=ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.ModelBinding.ModelBinderFactory
index=113,service=ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IObjectModelValidator Lifetime: Singleton ImplementationFactory: Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IObjectModelValidator <AddMvcCoreServices>b__5_1(System.IServiceProvider)
index=114,service=ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ClientValidatorCache Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ClientValidatorCache
index=115,service=ServiceType: Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.ModelBinding.ParameterBinder
index=116,service=ServiceType: Microsoft.Extensions.DependencyInjection.MvcMarkerService Lifetime: Singleton ImplementationType: Microsoft.Extensions.DependencyInjection.MvcMarkerService
index=117,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.ITypeActivatorCache Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.TypeActivatorCache
index=118,service=ServiceType: Microsoft.AspNetCore.Mvc.Routing.IUrlHelperFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.UrlHelperFactory
index=119,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IHttpRequestStreamReaderFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.MemoryPoolHttpRequestStreamReaderFactory
index=120,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IHttpResponseStreamWriterFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.MemoryPoolHttpResponseStreamWriterFactory
index=121,service=ServiceType: System.Buffers.ArrayPool`1[System.Byte] Lifetime: Singleton ImplementationInstance: System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1[System.Byte]
index=122,service=ServiceType: System.Buffers.ArrayPool`1[System.Char] Lifetime: Singleton ImplementationInstance: System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1[System.Char]
index=123,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.OutputFormatterSelector Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.DefaultOutputFormatterSelector
index=124,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.ObjectResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor
index=125,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.PhysicalFileResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.PhysicalFileResultExecutor
index=126,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.VirtualFileResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.VirtualFileResultExecutor
index=127,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.FileStreamResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.FileStreamResultExecutor
index=128,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.FileContentResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.FileContentResultExecutor
index=129,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.RedirectResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.RedirectResultExecutor
index=130,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.LocalRedirectResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.LocalRedirectResultExecutor
index=131,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.RedirectToActionResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.RedirectToActionResultExecutor
index=132,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.RedirectToRouteResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.RedirectToRouteResultExecutor
index=133,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.RedirectToPageResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.RedirectToPageResultExecutor
index=134,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.ContentResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ContentResultExecutor
index=135,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IClientErrorFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.ProblemDetailsClientErrorFactory
index=136,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.ProblemDetailsFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Infrastructure.DefaultProblemDetailsFactory
index=137,service=ServiceType: Microsoft.AspNetCore.Mvc.Routing.MvcRouteHandler Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.MvcRouteHandler
index=138,service=ServiceType: Microsoft.AspNetCore.Mvc.Routing.MvcAttributeRouteHandler Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Routing.MvcAttributeRouteHandler
index=139,service=ServiceType: Microsoft.AspNetCore.Mvc.Routing.ControllerActionEndpointDataSource Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.ControllerActionEndpointDataSource
index=140,service=ServiceType: Microsoft.AspNetCore.Mvc.Routing.ActionEndpointFactory Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.ActionEndpointFactory
index=141,service=ServiceType: Microsoft.AspNetCore.Mvc.Routing.DynamicControllerEndpointSelector Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.DynamicControllerEndpointSelector
index=142,service=ServiceType: Microsoft.AspNetCore.Routing.MatcherPolicy Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Routing.DynamicControllerEndpointMatcherPolicy
index=143,service=ServiceType: Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterConfigurationProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterConfigurationProvider
index=144,service=ServiceType: Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilder Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilder
index=145,service=ServiceType: Microsoft.AspNetCore.Hosting.IStartupFilter Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter
index=146,service=ServiceType: Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionGroupCollectionProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionGroupCollectionProvider
index=147,service=ServiceType: Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.ApiExplorer.DefaultApiDescriptionProvider
index=148,service=ServiceType: Microsoft.AspNetCore.Authentication.IAuthenticationService Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Authentication.AuthenticationService
index=149,service=ServiceType: Microsoft.AspNetCore.Authentication.IClaimsTransformation Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Authentication.NoopClaimsTransformation
index=150,service=ServiceType: Microsoft.AspNetCore.Authentication.IAuthenticationHandlerProvider Lifetime: Scoped ImplementationType: Microsoft.AspNetCore.Authentication.AuthenticationHandlerProvider
index=151,service=ServiceType: Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Authentication.AuthenticationSchemeProvider
index=152,service=ServiceType: Microsoft.AspNetCore.Authorization.IAuthorizationService Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService
index=153,service=ServiceType: Microsoft.AspNetCore.Authorization.IAuthorizationPolicyProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Authorization.DefaultAuthorizationPolicyProvider
index=154,service=ServiceType: Microsoft.AspNetCore.Authorization.IAuthorizationHandlerProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Authorization.DefaultAuthorizationHandlerProvider
index=155,service=ServiceType: Microsoft.AspNetCore.Authorization.IAuthorizationEvaluator Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Authorization.DefaultAuthorizationEvaluator
index=156,service=ServiceType: Microsoft.AspNetCore.Authorization.IAuthorizationHandlerContextFactory Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Authorization.DefaultAuthorizationHandlerContextFactory
index=157,service=ServiceType: Microsoft.AspNetCore.Authorization.IAuthorizationHandler Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Authorization.Infrastructure.PassThroughAuthorizationHandler
index=158,service=ServiceType: Microsoft.AspNetCore.Authorization.Policy.AuthorizationPolicyMarkerService Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Authorization.Policy.AuthorizationPolicyMarkerService
index=159,service=ServiceType: Microsoft.AspNetCore.Authorization.Policy.IPolicyEvaluator Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Authorization.Policy.PolicyEvaluator
index=160,service=ServiceType: Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.ApplicationModels.AuthorizationApplicationModelProvider
index=161,service=ServiceType: Microsoft.AspNetCore.Mvc.ApplicationModels.IApplicationModelProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Cors.CorsApplicationModelProvider
index=162,service=ServiceType: Microsoft.AspNetCore.Mvc.Cors.CorsAuthorizationFilter Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.Cors.CorsAuthorizationFilter
index=163,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions] Lifetime: Transient ImplementationType: Microsoft.Extensions.DependencyInjection.MvcDataAnnotationsMvcOptionsSetup
index=164,service=ServiceType: Microsoft.AspNetCore.Mvc.DataAnnotations.IValidationAttributeAdapterProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.DataAnnotations.ValidationAttributeAdapterProvider
index=165,service=ServiceType: Microsoft.AspNetCore.Mvc.Formatters.FormatFilter Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.Formatters.FormatFilter
index=166,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Options.ConfigureNamedOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions]
index=167,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions] Lifetime: Transient ImplementationType: Microsoft.Extensions.DependencyInjection.NewtonsoftJsonMvcOptionsSetup
index=168,service=ServiceType: Microsoft.AspNetCore.Mvc.ApiExplorer.IApiDescriptionProvider Lifetime: Transient ImplementationType: Microsoft.AspNetCore.Mvc.NewtonsoftJson.JsonPatchOperationsArrayProvider
index=169,service=ServiceType: Microsoft.AspNetCore.Mvc.Infrastructure.IActionResultExecutor`1[Microsoft.AspNetCore.Mvc.JsonResult] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.NewtonsoftJson.NewtonsoftJsonResultExecutorindex=170,service=ServiceType: Microsoft.AspNetCore.Mvc.ViewFeatures.Infrastructure.TempDataSerializer Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.NewtonsoftJson.BsonTempDataSerializer
index=171,service=ServiceType: Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.Mvc.NewtonsoftJson.NewtonsoftJsonHelper
index=172,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.Mvc.MvcNewtonsoftJsonOptions] Lifetime: Singleton ImplementationInstance: Microsoft.Extensions.Options.ConfigureNamedOptions`1[Microsoft.AspNetCore.Mvc.MvcNewtonsoftJsonOptions]
index=173,service=ServiceType: Microsoft.Extensions.Caching.Memory.IMemoryCache Lifetime: Singleton ImplementationType: Microsoft.Extensions.Caching.Memory.MemoryCache
index=174,service=ServiceType: Microsoft.AspNetCore.DataProtection.Internal.IActivator Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.TypeForwardingActivator
index=175,service=ServiceType: Microsoft.AspNetCore.DataProtection.IRegistryPolicyResolver Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.RegistryPolicyResolver
index=176,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.DataProtection.KeyManagement.KeyManagementOptions] Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.Internal.KeyManagementOptionsSetup
index=177,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.DataProtection.DataProtectionOptions] Lifetime: Transient ImplementationType: Microsoft.AspNetCore.DataProtection.Internal.DataProtectionOptionsSetup
index=178,service=ServiceType: Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager
index=179,service=ServiceType: Microsoft.AspNetCore.DataProtection.Infrastructure.IApplicationDiscriminator Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.Internal.HostingApplicationDiscriminator
index=180,service=ServiceType: Microsoft.Extensions.Hosting.IHostedService Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.Internal.DataProtectionHostedService
index=181,service=ServiceType: Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IDefaultKeyResolver Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver
index=182,service=ServiceType: Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IKeyRingProvider Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider
index=183,service=ServiceType: Microsoft.AspNetCore.DataProtection.IDataProtectionProvider Lifetime: Singleton ImplementationFactory: Microsoft.AspNetCore.DataProtection.IDataProtectionProvider <AddDataProtectionServices>b__2_0(System.IServiceProvider)
index=184,service=ServiceType: Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver Lifetime: Singleton ImplementationType: Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateResolver
index=185,service=ServiceType: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.DataProtection.KeyManagement.KeyManagementOptions] Lifetime: Singleton ImplementationFactory: Microsoft.Extensions.Options.IConfigureOptions`1[Microsoft.AspNetCore.DataProtection.KeyManagement.KeyManagementOptions] <PersistKeysToFileSystem>b__0(System.IServiceProvider)

C# 特性

特性

Attribute

特性本质是一个类;

特性:这个类继承自Attribute抽象类(直接或者间接继承);

特性分类:系统自带、自定义;影响编译器的特性[Obsolete],影响程序实现过程的[Serializable];

特性:就是用一个类给另一个类贴标签,贴上标签就产生了新功能;

特性作用对象:类、属性、字段、方法、参数、返回值,都可以添加特性

[return:MyAttribute] [MyAttribute(a=1,b=2)]

特性是一种允许我们向程序的程序集添加元数据的语言结构。它是用于保存程序结构信息的特殊类型的类。

特性(Attribute)是用于在运行时传递程序中各种元素(比如类、方法、结构、枚举、组件等)的行为信息的声明性标签。

用特性标记后,会在对象内部产生一个custom元素,但是无法访问

metadata是一个数据清单,包含特性的描述,使用反射reflection就可以访问和使用特性元数据;

特性本身是毫无价值的,只有通过反射获取并使用后,才有用

IsDefined(Type, Boolean) :检测某个特性是否应用到某个类上。

 

AOP

面向切面

 

面向切面编程AOP=Aspect Oriented Programming

l 在不修改之前代码的基础上,动态增加业务逻辑;

l 在已经成型的程序中,可以动态的在某些行为之前增加点内容;在某些行为之后增加点内容;

l 而保证之前已经开发好的内容保持不变;

l 这符合开闭原则(对扩展开放,对修改封闭);

 

AOP:ASP.NET Core中Filter,可以实现AOP

■ResourceFilter:框架提供IResourceFilter接口;

1) 以特性的方式实现IResourceFilter接口;

2) 新建一个MyResourceFilterAttribute类,继承Attribute类,并实现接口IResourceFilter;

3) 实现IResourceFilter中的两个方法;

4) OnResourceExecuting是在被标记的方法执行前执行的方法;

5) OnResourceExecuted是在被标记的方法执行完成之后执行的方法;

6) IResourceFilter不仅仅Action方法被拦截,就连控制器的构造函数也会被拦截;

7) 现在的执行顺序是OnResourceExecuting→Controller()→Action→OnResourceExecuted;

ResourceFilter相当于在某个方法的执行前后各增加了一个方法;

ResourceFilter适合用来做缓存cache;

ResourceFilter适合用来做拦截,因为他可以在某个方法执行前执行OnResourceExecuting;

缓存:内存中的一个临时字典,由key和value组成,存取数据都需要用到key;

Filter注册方式:

1、方法注册,将特性标记在方法上,则仅仅对标记的方法执行AOP拦截;

2、控制器注册,将特性标记在控制器Controller上,则对类中所有方法执行AOP拦截;

3、全局注册,则对当前项目中所有方法都生效;

services.AddControllers(option=>option.Filters.Add<MyResourceFilterAttribute>());

■IActionFilter:在类的构造函数之后执行拦截和过滤;

① 新建一个MyActionFilterAttribute继承Attribute并实现接口IActionFilter接口;

② 实现接口的两个方法(Action执行前的方法,和Action执行后的方法);

③ OnActionExecuting是在被标记的方法执行前执行的方法;

④ OnActionExecuted是在被标记的方法执行完成之后执行的方法;

⑤ 将该特性标记在某个Action方法上;

⑥ 执行顺序:Controller()→OnActionExecuting→Action→OnActionExecuted;

IActionFilter做缓存,需要首先实例化控制器,如果有缓存的话,这个实例化的控制器根本就没用;

IResourceFilter做缓存,首先检查有没有缓存,如果有缓存,则不会实例化控制器;

IResourceFilter不会做无效的控制器实例化,所以更加适合做缓存,效率更高;

IActionFilter非常适合做Log日志;Log4Net、 NLog

[TypeFilter(typeof(MyLogActionFilterAttribute))]

 

IExceptionFilter:为方法捕获异常,并统一处理异常;

创建一个自定义属性MyExceptionFilterAttribute,继承Attribute并实现IExceptionFilter;

实现接口中的OnException方法,这就是异常处理方法;

使用特性(Action方法、Controller类、全局注册);

使用:[TypeFilter(typeof(MyExceptionFilterAttribute))];

public void OnException(ExceptionContext context)

{

if(!context.ExceptionHandled)

{

//处理异常的代码

//1、如果是请求Json,就组装一个JsonResult返回给用户;

//2、如果是请求页面,就返回一个错误页面ViewResult;

}

context.ExceptionHandled=true;//标记为已处理

}

IExceptionFilter能捕获哪些异常?

1) Action出现的没有处理的异常:可以捕获

2) Action出现已将处理的异常:不能捕获,异常已经被处理,就不是异常了

3) Service层异常:可以

4) View绑定异常:不能

5) 控制器构造函数异常:可以

6) 不存在的URL地址:不能

7) 其他Filter中的异常:ActionFilter可以捕获;

IExceptionFilter只能捕获部分异常;

捕获异常的助手:

app.UseStatusCodePagesWithReExecute(“ErrorPage”);//只要不是200,都能进来

app.UseExceptionHandler(errorApp=>errorApp.Run(async context=>{}));

 

Failed to load API definition.

Fetch error Internal Server Error /swagger/v1/swagger.json

asp.net get获取参数乱码 asp.net attributes_网络编程

结论:

n Ambiguous HTTP method for action,翻译后是“不明确的HTTP操作方法”。

n 有可能是没写HTTP方法,如 [HttpGet]、[HttpPost] ,在方法上添加上即可。

n 也可能是将一些原本应该是私有的方法,写了public导致的。

 

导致错误的几种情况:

l 部分方法或者参数没有放好注释。

l 部分Public的方法没有设置好路由,仅在Controller级别设置了路由。将无需暴露的方法都设置为私有的。考虑在Controller级别设置[Route("api/[controller]/[action]")]

l 生成的XML文件没有使用相对地址。注意:默认使用的是绝对地址,源码位置一有变化就会出问题。

l XML文件需设置为“始终复制”

l 接口

数据流向:

数据库→EFContext

→IRepositories→Repositories

→IBaseServices→BaseServices

→IArticleService→ArticleService

→ArticleController→Article→ArticleDto

①→Swagger→Page/User→

②→DataBag→Razor→Page→User→

 

自定义DBContext

添加依赖包

SqlServer

1、Microsoft.EntityFrameworkCore.Design
2、Microsoft.EntityFrameworkCore.Tools
3、Microsoft.EntityFrameworkCore
4、microsoft.entityframeworkcore.sqlserver

添加依赖包

MySQL

1、Microsoft.EntityFrameworkCore.Design
2、Microsoft.EntityFrameworkCore.Tools
3、MySql.EntityFrameworkCore
4、Microsoft.EntityFrameworkCore
5、Microsoft.EntityFrameworkCore.Relational

创建自定义

dbContext类

public  class SwiftCodeBbsContext:DbContext
要继承DbContext

添加构造函数

public SwiftCodeBbsContext()        {        }
        public SwiftCodeBbsContext(DbContextOptions<SwiftCodeBbsContext> options):base(options)
        {       }

创建数据集

//创建实体对象数据集
        public DbSet<Article> Articles { get; set; }
        public DbSet<UserInfo> UserInfos { get; set; }
        public DbSet<Question> Questions { get; set; }
        public DbSet<ArticleComment> ArticleComments { get; set; }
        public DbSet<QuestionComment> QuestionComments { get; set; }
        public DbSet<Advertisement> Advertisements { get; set; }

相关设置

protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            //文章
            //public virtual EntityTypeBuilder<TEntity> Entity<TEntity>()
            var articleConfig = modelBuilder.Entity<Article>();
            articleConfig.Property(p => p.Title).HasMaxLength(128);
           articleConfig.Property(p => p.Content).HasMaxLength(2048);
           articleConfig.Property(p => p.Tag).HasMaxLength(128);
           articleConfig.Property(p => p.CreateTime).HasColumnType("datetime");
            //Restrict 1 对于上下文跟踪的实体,删除相关主体时,依赖实体中的外键属性值将设置为 null。
            //这有助于在跟踪实体时使实体图保持一致状态,以便可以将完全一致的图形写入数据库。
            //如果属性由于不是可以为 null 的类型而无法设置为 null,则在调用 时 SaveChanges() 将引发异常。
            articleConfig.HasOne(p => p.CreateUser).WithMany().HasForeignKey(p => p.CreateUserId).OnDelete(DeleteBehavior.Restrict);
            //Cascade  3 对于由上下文跟踪的实体,在删除相关主体时,将删除依赖实体。
            articleConfig.HasMany(p => p.CollectionArticles).WithOne().HasForeignKey(p => p.ArticleId).OnDelete(DeleteBehavior.Cascade);
            articleConfig.HasMany(p => p.ArticleComments).WithOne().HasForeignKey(p => p.ArticleId).OnDelete(DeleteBehavior.Cascade);
            var articleCommentConfig = modelBuilder.Entity<ArticleComment>();
            articleCommentConfig.Property(p => p.Content).HasMaxLength(512);
            articleCommentConfig.Property(p=>p.CreateTime).HasColumnType("datetime");
            articleCommentConfig.HasOne(p => p.CreateUser).WithMany().HasForeignKey(p => p.CreateUserId).OnDelete(DeleteBehavior.Restrict);
 
 
            //用户
            var userInfoConfig = modelBuilder.Entity<UserInfo>();
            userInfoConfig.Property(p => p.UserName).HasMaxLength(64);
            userInfoConfig.Property(p => p.LoginName).HasMaxLength(64);
            userInfoConfig.Property(p => p.LoginPassWord).HasMaxLength(128);
            userInfoConfig.Property(p => p.Phone).HasMaxLength(16);
            userInfoConfig.Property(p => p.Introduction).HasMaxLength(512);
            userInfoConfig.Property(p => p.Email).HasMaxLength(64);
            userInfoConfig.Property(p => p.HeadPortrait).HasMaxLength(1024);
            userInfoConfig.Property(p => p.CreateTime).HasColumnType("datetime");
 
            //问答
            var questionConfig = modelBuilder.Entity<Question>();
            questionConfig.Property(p => p.Title).HasMaxLength(128);
            questionConfig.Property(p => p.Content).HasMaxLength(2048);
            questionConfig.Property(p => p.Tag ).HasMaxLength(128);
            questionConfig.Property(p => p.CreateTime).HasColumnType("datetime");
            questionConfig.HasOne(p => p.CreateUser).WithMany().HasForeignKey(p => p.CreateUserId).OnDelete(DeleteBehavior.Restrict);
            questionConfig.HasMany(p => p.QustionComments).WithOne(p=>p.Question).HasForeignKey(p => p.QuestionId).OnDelete(DeleteBehavior.Cascade);
 
            //问题评论
            var questionCommentConfig = modelBuilder.Entity<QuestionComment>();
            questionCommentConfig.Property(p => p.Content).HasMaxLength(512);
            questionCommentConfig.Property(p => p.CreateTime).HasColumnType("datetime");
            questionCommentConfig.HasOne(p => p.CreateUser).WithMany().HasForeignKey(p => p.CreateUserId).OnDelete(DeleteBehavior.Restrict);
 
            //广告
            var advertisementConfig = modelBuilder.Entity<Advertisement>();
            advertisementConfig.Property(p => p.ImgUrl).HasMaxLength(1024);
            advertisementConfig.Property(p => p.Url).HasMaxLength(128);
        }

连接数据库

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {  optionsBuilder.UseMySQL("server=localhost;database=SwiftCodeBbs;user=root;password=123456;port=3308;pooling=true;max pool size=20;persist security info=True;charset=utf8mb4;")
                //UseSqlServer(@"Server=.;Database=SwiftCodeBbs;Trusted_Connection=true;Connection Timeout=600;MultipleActiveResultSets=true;")
                .LogTo(Console.WriteLine, LogLevel.Information);
        }

 

24.定位到行首与行尾

1)home键:定位到当前行的行首;

2)end键:定位到当前行的行尾。

25.选中从光标起到行首(尾)间的代码

1)选中从光标起到行首间的代码:使用组合键“Shift + Home”;

2)选中从光标起到行尾间的代码:使用组合键“Shift + End” 

字段自动生成属性快捷键 ctrl+r,ctrl+e 有人说是加个分号 就不需要写get set了