From ff3395e79e22b6823a314b6b5a0a70186446e6ec Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:15:47 +0000 Subject: [PATCH] style: format code with dotnet-format This commit fixes the style issues introduced in 684b201 according to the output from dotnet-format. Details: None --- src/Blazor/ExampleJsInterop.cs | 4 +- src/Mvc/MvcOptions.cs | 423 +++++++++++++++++---------------- 2 files changed, 214 insertions(+), 213 deletions(-) diff --git a/src/Blazor/ExampleJsInterop.cs b/src/Blazor/ExampleJsInterop.cs index b14e97df..8af2a177 100644 --- a/src/Blazor/ExampleJsInterop.cs +++ b/src/Blazor/ExampleJsInterop.cs @@ -15,8 +15,8 @@ public class ExampleJsInterop : IAsyncDisposable public ExampleJsInterop(IJSRuntime jsRuntime) { - moduleTask = new (() => jsRuntime.InvokeAsync( - "import", "./_content/Dgmjr.AspNetCore.Razor.Components/exampleJsInterop.js").AsTask()); + moduleTask = new(() => jsRuntime.InvokeAsync( + "import", "./_content/Dgmjr.AspNetCore.Razor.Components/exampleJsInterop.js").AsTask()); } public async ValueTask Prompt(string message) diff --git a/src/Mvc/MvcOptions.cs b/src/Mvc/MvcOptions.cs index 119e12c0..8c4fd48b 100644 --- a/src/Mvc/MvcOptions.cs +++ b/src/Mvc/MvcOptions.cs @@ -21,215 +21,216 @@ public MvcOptions() AllowEmptyInputInBodyModelBinding = false, RespectBrowserAcceptHeader = true } - ) { } - - /// if you want to add controllers with views, otherwise - public virtual bool AddControllersWithViews { get; set; } = false; - public virtual bool AddControllersAsServices { get; set; } = false; - - /// if you want to add Razor pages, otherwise - public virtual bool AddRazorPages { get; set; } = false; - /// if you want to add Razor components, otherwise - public virtual bool AddRazorComponents { get; set; } = false; - /// if you want to add interactive server components, otherwise - public virtual bool AddInteractiveServerComponents { get; set; } = false; - - /// if you want to add controllers with views, otherwise - /// public virtual bool AddControllersAsServices { get; set; } = false; - - /// if you want to add the Microsoft Identity UI, otherwise - public virtual bool AddMicrosoftIdentityUI { get; set; } = false; - - /// if you want to add JSON serializer otherwise - public virtual bool AddJsonOptions { get; set; } = false; - - /// if you want to add XML serializer formatters, otherwise - public virtual bool AddXmlSerializerFormatters { get; set; } = false; - - /// if you want to add XML data contract serializer formatters, otherwise - public virtual bool AddXmlDataContractSerializerFormatters { get; set; } = false; - - /// if you want to add the DGMJR MVC conventions, otherwise - public virtual bool AddMvcConventions { get; set; } = false; - - /// if you want to add controllers, otherwise - public virtual bool AddControllers { get; set; } = false; - - /// - public virtual bool AllowEmptyInputInBodyModelBinding { get; set; } = - mvc.AllowEmptyInputInBodyModelBinding; - - /// - public virtual bool EnableActionInvokers { get; set; } = mvc.EnableActionInvokers; - - /// - public virtual bool EnableEndpointRouting { get; set; } = mvc.EnableEndpointRouting; - - /// - public virtual bool RespectBrowserAcceptHeader { get; set; } = mvc.RespectBrowserAcceptHeader; - - /// - public virtual bool RequireHttpsPermanent { get; set; } = mvc.RequireHttpsPermanent; - - /// - public virtual bool SuppressAsyncSuffixInActionNames { get; set; } = - mvc.SuppressAsyncSuffixInActionNames; - - /// - public virtual bool SuppressInputFormatterBuffering { get; set; } = - mvc.SuppressInputFormatterBuffering; - - /// - public virtual bool SuppressOutputFormatterBuffering { get; set; } = - mvc.SuppressOutputFormatterBuffering; - - /// - public virtual bool ValidateComplexTypesIfChildValidationFails { get; set; } = - mvc.ValidateComplexTypesIfChildValidationFails; - - /// - public virtual bool SuppressImplicitRequiredAttributeForNonNullableReferenceTypes { get; set; } = - mvc.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes; - - /// - public virtual bool ReturnHttpNotAcceptable { get; set; } = mvc.ReturnHttpNotAcceptable; - - /// if you want to use antiforgery, otherwise - /// !!! Only supported in .NET 8.0+ !!!! Ignored otherwise. - public virtual bool UseAntiforgery { get; set; } = true; - - /// - public virtual IDictionary CacheProfiles { get; set; } = - mvc.CacheProfiles; - - /// - public virtual IList Conventions { get; set; } = mvc.Conventions; - - /// - public virtual FilterCollection Filters { get; set; } = mvc.Filters; - - /// - public virtual FormatterMappings FormatterMappings { get; set; } = mvc.FormatterMappings; - - /// - public virtual FormatterCollection InputFormatters { get; set; } = - mvc.InputFormatters; - - /// - public virtual int MaxModelValidationErrors { get; set; } = mvc.MaxModelValidationErrors; - - /// - public virtual IList ModelBinderProviders { get; set; } = - mvc.ModelBinderProviders; - - /// - public virtual DefaultModelBindingMessageProvider ModelBindingMessageProvider { get; set; } = - mvc.ModelBindingMessageProvider; - - /// - public virtual IList ModelMetadataDetailsProviders { get; set; } = - mvc.ModelMetadataDetailsProviders; - - /// - public virtual IList ModelValidatorProviders { get; set; } = - mvc.ModelValidatorProviders; - - /// - public virtual FormatterCollection OutputFormatters { get; set; } = - mvc.OutputFormatters; - - /// - public virtual IList ValueProviderFactories { get; set; } = - mvc.ValueProviderFactories; - - /// - public virtual int? SslPort { get; set; } = mvc.SslPort; - - /// - public virtual int? MaxValidationDepth { get; set; } = mvc.MaxValidationDepth; - - /// - public virtual int MaxModelBindingCollectionSize { get; set; } = - mvc.MaxModelBindingCollectionSize; - - /// - public virtual int MaxModelBindingRecursionDepth { get; set; } = - mvc.MaxModelBindingRecursionDepth; - - /// - public virtual int MaxIAsyncEnumerableBufferLimit { get; set; } = - mvc.MaxIAsyncEnumerableBufferLimit; - - public static implicit operator MsMvcOptions(MvcOptions options) => - options.CopyTo(new MsMvcOptions()); - - public virtual MsMvcOptions CopyTo(MsMvcOptions mvcOpts) - { - mvcOpts.AllowEmptyInputInBodyModelBinding = AllowEmptyInputInBodyModelBinding; - mvcOpts.EnableActionInvokers = EnableActionInvokers; - mvcOpts.EnableEndpointRouting = EnableEndpointRouting; - mvcOpts.MaxIAsyncEnumerableBufferLimit = MaxIAsyncEnumerableBufferLimit; - mvcOpts.MaxModelBindingCollectionSize = MaxModelBindingCollectionSize; - mvcOpts.MaxModelBindingRecursionDepth = MaxModelBindingRecursionDepth; - mvcOpts.MaxModelValidationErrors = MaxModelValidationErrors; - mvcOpts.MaxValidationDepth = MaxValidationDepth; - mvcOpts.RequireHttpsPermanent = RequireHttpsPermanent; - mvcOpts.RespectBrowserAcceptHeader = RespectBrowserAcceptHeader; - mvcOpts.ReturnHttpNotAcceptable = ReturnHttpNotAcceptable; - mvcOpts.SslPort = SslPort; - mvcOpts.SuppressAsyncSuffixInActionNames = SuppressAsyncSuffixInActionNames; - mvcOpts.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = - SuppressImplicitRequiredAttributeForNonNullableReferenceTypes; - mvcOpts.SuppressInputFormatterBuffering = SuppressInputFormatterBuffering; - mvcOpts.SuppressOutputFormatterBuffering = SuppressOutputFormatterBuffering; - mvcOpts.ValidateComplexTypesIfChildValidationFails = - ValidateComplexTypesIfChildValidationFails; - - // mvcOpts.CacheProfiles.Clear(); - foreach (var profile in CacheProfiles) - { - mvcOpts.CacheProfiles[profile.Key] = profile.Value; - } - // mvcOpts.Filters.Clear(); - foreach (var v in Filters) - { - mvcOpts.Filters.Add(v); - } - // mvcOpts.InputFormatters.Clear(); - foreach (var v in InputFormatters) - { - mvcOpts.InputFormatters.Add(v); - } - // mvcOpts.OutputFormatters.Clear(); - foreach (var v in OutputFormatters) - { - mvcOpts.OutputFormatters.Add(v); - } - // mvcOpts.Conventions.Clear(); - foreach (var v in Conventions) - { - mvcOpts.Conventions.Add(v); - } - // mvcOpts.ValueProviderFactories.Clear(); - foreach (var v in ValueProviderFactories) - { - mvcOpts.ValueProviderFactories.Add(v); - } - // mvcOpts.ModelBinderProviders.Clear(); - foreach (var v in ModelBinderProviders) - { - mvcOpts.ModelBinderProviders.Add(v); - } - // mvcOpts.ModelMetadataDetailsProviders.Clear(); - foreach (var v in ModelMetadataDetailsProviders) - { - mvcOpts.ModelMetadataDetailsProviders.Add(v); - } - // mvcOpts.ModelValidatorProviders.Clear(); - foreach (var v in ModelValidatorProviders) - { - mvcOpts.ModelValidatorProviders.Add(v); - } - return mvcOpts; - } + ) +{ } + +/// if you want to add controllers with views, otherwise +public virtual bool AddControllersWithViews { get; set; } = false; +public virtual bool AddControllersAsServices { get; set; } = false; + +/// if you want to add Razor pages, otherwise +public virtual bool AddRazorPages { get; set; } = false; +/// if you want to add Razor components, otherwise +public virtual bool AddRazorComponents { get; set; } = false; +/// if you want to add interactive server components, otherwise +public virtual bool AddInteractiveServerComponents { get; set; } = false; + +/// if you want to add controllers with views, otherwise +/// public virtual bool AddControllersAsServices { get; set; } = false; + +/// if you want to add the Microsoft Identity UI, otherwise +public virtual bool AddMicrosoftIdentityUI { get; set; } = false; + +/// if you want to add JSON serializer otherwise +public virtual bool AddJsonOptions { get; set; } = false; + +/// if you want to add XML serializer formatters, otherwise +public virtual bool AddXmlSerializerFormatters { get; set; } = false; + +/// if you want to add XML data contract serializer formatters, otherwise +public virtual bool AddXmlDataContractSerializerFormatters { get; set; } = false; + +/// if you want to add the DGMJR MVC conventions, otherwise +public virtual bool AddMvcConventions { get; set; } = false; + +/// if you want to add controllers, otherwise +public virtual bool AddControllers { get; set; } = false; + +/// +public virtual bool AllowEmptyInputInBodyModelBinding { get; set; } = + mvc.AllowEmptyInputInBodyModelBinding; + +/// +public virtual bool EnableActionInvokers { get; set; } = mvc.EnableActionInvokers; + +/// +public virtual bool EnableEndpointRouting { get; set; } = mvc.EnableEndpointRouting; + +/// +public virtual bool RespectBrowserAcceptHeader { get; set; } = mvc.RespectBrowserAcceptHeader; + +/// +public virtual bool RequireHttpsPermanent { get; set; } = mvc.RequireHttpsPermanent; + +/// +public virtual bool SuppressAsyncSuffixInActionNames { get; set; } = + mvc.SuppressAsyncSuffixInActionNames; + +/// +public virtual bool SuppressInputFormatterBuffering { get; set; } = + mvc.SuppressInputFormatterBuffering; + +/// +public virtual bool SuppressOutputFormatterBuffering { get; set; } = + mvc.SuppressOutputFormatterBuffering; + +/// +public virtual bool ValidateComplexTypesIfChildValidationFails { get; set; } = + mvc.ValidateComplexTypesIfChildValidationFails; + +/// +public virtual bool SuppressImplicitRequiredAttributeForNonNullableReferenceTypes { get; set; } = + mvc.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes; + +/// +public virtual bool ReturnHttpNotAcceptable { get; set; } = mvc.ReturnHttpNotAcceptable; + +/// if you want to use antiforgery, otherwise +/// !!! Only supported in .NET 8.0+ !!!! Ignored otherwise. +public virtual bool UseAntiforgery { get; set; } = true; + +/// +public virtual IDictionary CacheProfiles { get; set; } = + mvc.CacheProfiles; + +/// +public virtual IList Conventions { get; set; } = mvc.Conventions; + +/// +public virtual FilterCollection Filters { get; set; } = mvc.Filters; + +/// +public virtual FormatterMappings FormatterMappings { get; set; } = mvc.FormatterMappings; + +/// +public virtual FormatterCollection InputFormatters { get; set; } = + mvc.InputFormatters; + +/// +public virtual int MaxModelValidationErrors { get; set; } = mvc.MaxModelValidationErrors; + +/// +public virtual IList ModelBinderProviders { get; set; } = + mvc.ModelBinderProviders; + +/// +public virtual DefaultModelBindingMessageProvider ModelBindingMessageProvider { get; set; } = + mvc.ModelBindingMessageProvider; + +/// +public virtual IList ModelMetadataDetailsProviders { get; set; } = + mvc.ModelMetadataDetailsProviders; + +/// +public virtual IList ModelValidatorProviders { get; set; } = + mvc.ModelValidatorProviders; + +/// +public virtual FormatterCollection OutputFormatters { get; set; } = + mvc.OutputFormatters; + +/// +public virtual IList ValueProviderFactories { get; set; } = + mvc.ValueProviderFactories; + +/// +public virtual int? SslPort { get; set; } = mvc.SslPort; + +/// +public virtual int? MaxValidationDepth { get; set; } = mvc.MaxValidationDepth; + +/// +public virtual int MaxModelBindingCollectionSize { get; set; } = + mvc.MaxModelBindingCollectionSize; + +/// +public virtual int MaxModelBindingRecursionDepth { get; set; } = + mvc.MaxModelBindingRecursionDepth; + +/// +public virtual int MaxIAsyncEnumerableBufferLimit { get; set; } = + mvc.MaxIAsyncEnumerableBufferLimit; + +public static implicit operator MsMvcOptions(MvcOptions options) => + options.CopyTo(new MsMvcOptions()); + +public virtual MsMvcOptions CopyTo(MsMvcOptions mvcOpts) +{ + mvcOpts.AllowEmptyInputInBodyModelBinding = AllowEmptyInputInBodyModelBinding; + mvcOpts.EnableActionInvokers = EnableActionInvokers; + mvcOpts.EnableEndpointRouting = EnableEndpointRouting; + mvcOpts.MaxIAsyncEnumerableBufferLimit = MaxIAsyncEnumerableBufferLimit; + mvcOpts.MaxModelBindingCollectionSize = MaxModelBindingCollectionSize; + mvcOpts.MaxModelBindingRecursionDepth = MaxModelBindingRecursionDepth; + mvcOpts.MaxModelValidationErrors = MaxModelValidationErrors; + mvcOpts.MaxValidationDepth = MaxValidationDepth; + mvcOpts.RequireHttpsPermanent = RequireHttpsPermanent; + mvcOpts.RespectBrowserAcceptHeader = RespectBrowserAcceptHeader; + mvcOpts.ReturnHttpNotAcceptable = ReturnHttpNotAcceptable; + mvcOpts.SslPort = SslPort; + mvcOpts.SuppressAsyncSuffixInActionNames = SuppressAsyncSuffixInActionNames; + mvcOpts.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = + SuppressImplicitRequiredAttributeForNonNullableReferenceTypes; + mvcOpts.SuppressInputFormatterBuffering = SuppressInputFormatterBuffering; + mvcOpts.SuppressOutputFormatterBuffering = SuppressOutputFormatterBuffering; + mvcOpts.ValidateComplexTypesIfChildValidationFails = + ValidateComplexTypesIfChildValidationFails; + + // mvcOpts.CacheProfiles.Clear(); + foreach (var profile in CacheProfiles) + { + mvcOpts.CacheProfiles[profile.Key] = profile.Value; + } + // mvcOpts.Filters.Clear(); + foreach (var v in Filters) + { + mvcOpts.Filters.Add(v); + } + // mvcOpts.InputFormatters.Clear(); + foreach (var v in InputFormatters) + { + mvcOpts.InputFormatters.Add(v); + } + // mvcOpts.OutputFormatters.Clear(); + foreach (var v in OutputFormatters) + { + mvcOpts.OutputFormatters.Add(v); + } + // mvcOpts.Conventions.Clear(); + foreach (var v in Conventions) + { + mvcOpts.Conventions.Add(v); + } + // mvcOpts.ValueProviderFactories.Clear(); + foreach (var v in ValueProviderFactories) + { + mvcOpts.ValueProviderFactories.Add(v); + } + // mvcOpts.ModelBinderProviders.Clear(); + foreach (var v in ModelBinderProviders) + { + mvcOpts.ModelBinderProviders.Add(v); + } + // mvcOpts.ModelMetadataDetailsProviders.Clear(); + foreach (var v in ModelMetadataDetailsProviders) + { + mvcOpts.ModelMetadataDetailsProviders.Add(v); + } + // mvcOpts.ModelValidatorProviders.Clear(); + foreach (var v in ModelValidatorProviders) + { + mvcOpts.ModelValidatorProviders.Add(v); + } + return mvcOpts; +} }