diff --git a/.editorconfig b/.editorconfig index 269c8e9725d6db445f8fc1d28a394a625072ef52..d0722647b7d5aff9ca7fd446403a0ef3289505ff 100644 --- a/.editorconfig +++ b/.editorconfig @@ -91,7 +91,7 @@ csharp_style_var_when_type_is_apparent = true:silent csharp_style_var_elsewhere = true:silent csharp_prefer_static_local_function= true:silent # Expression-bodied members -csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_methods =true:silent csharp_style_expression_bodied_constructors = false:silent csharp_style_expression_bodied_operators = false:silent csharp_style_expression_bodied_properties = true:silent @@ -150,3 +150,5 @@ visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public [*.cs] # Add file header file_header_template = Copyright (c) Argo Zhang (argo@163.com). All rights reserved.\nLicensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\nWebsite: https://www.blazor.zone or https://argozhang.github.io/ +csharp_style_namespace_declarations=file_scoped:suggestion +csharp_style_expression_bodied_local_functions=true:silent diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index 04c59691410565342e347d3b4ccaee1dccd46c16..c042c63e1f271b961b0477043cd368bb557dbc9b 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 6.1.1-beta06 + 6.1.1-beta08 diff --git a/src/BootstrapBlazor/Utils/BootstrapDynamicComponent.cs b/src/BootstrapBlazor/Utils/BootstrapDynamicComponent.cs index af46fb494f157fad4bdb319046a06d601de59243..24584d5bc3139ed08da0fb37ef899101624f6340 100644 --- a/src/BootstrapBlazor/Utils/BootstrapDynamicComponent.cs +++ b/src/BootstrapBlazor/Utils/BootstrapDynamicComponent.cs @@ -16,7 +16,7 @@ namespace BootstrapBlazor.Components /// /// 获得/设置 组件参数集合 /// - private IDictionary Parameters { get; set; } + private IDictionary? Parameters { get; set; } /// /// 获得/设置 组件类型 @@ -28,7 +28,7 @@ namespace BootstrapBlazor.Components /// /// /// TCom 组件所需要的参数集合 - public BootstrapDynamicComponent(Type componentType, IDictionary parameters) + public BootstrapDynamicComponent(Type componentType, IDictionary? parameters = null) { ComponentType = componentType; Parameters = parameters; @@ -40,7 +40,7 @@ namespace BootstrapBlazor.Components /// /// TCom 组件所需要的参数集合 /// - public static BootstrapDynamicComponent CreateComponent(IDictionary parameters) where TCom : IComponent => new(typeof(TCom), parameters); + public static BootstrapDynamicComponent CreateComponent(IDictionary? parameters = null) where TCom : IComponent => new(typeof(TCom), parameters); /// /// 创建自定义组件方法 @@ -57,9 +57,12 @@ namespace BootstrapBlazor.Components { var index = 0; builder.OpenComponent(index++, ComponentType); - foreach (var p in Parameters) + if (Parameters != null) { - builder.AddAttribute(index++, p.Key, p.Value); + foreach (var p in Parameters) + { + builder.AddAttribute(index++, p.Key, p.Value); + } } builder.CloseComponent(); };