Skip to content

Commit c0fd16e

Browse files
committed
fix: Update .editorconfig and refactor SQLHelper registration
Updated .editorconfig with new style preferences and modified existing ones. Refactored Load method in SQLHelperModule.cs to use an expression-bodied member. Updated RegisterSQLHelper method in Register.cs to check for existing SQLHelper service before adding.
1 parent fab0379 commit c0fd16e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

.editorconfig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ csharp_style_prefer_pattern_matching = true
9999
csharp_style_prefer_switch_expression = true
100100

101101
# Null-checking preferences
102-
csharp_style_conditional_delegate_call = true
102+
csharp_style_conditional_delegate_call = true:suggestion
103103

104104
# Modifier preferences
105105
csharp_prefer_static_local_function = true
@@ -135,7 +135,7 @@ csharp_using_directive_placement = outside_namespace:silent
135135
# New line preferences
136136
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
137137
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
138-
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
138+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
139139
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
140140
csharp_style_allow_embedded_statements_on_same_line_experimental = true
141141

@@ -285,4 +285,6 @@ end_of_line = crlf
285285
dotnet_style_explicit_tuple_names = true:suggestion
286286
dotnet_style_prefer_inferred_tuple_names = true:suggestion
287287
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
288-
dotnet_style_namespace_match_folder = false:suggestion
288+
dotnet_style_namespace_match_folder = false:suggestion
289+
dotnet_style_prefer_conditional_expression_over_assignment = false:silent
290+
dotnet_style_prefer_conditional_expression_over_return = false:silent

src/SQLHelper.DB/CanisterModules/SQLHelperModule.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ public class SQLHelperModule : IModule
1818
/// Loads the module using the bootstrapper
1919
/// </summary>
2020
/// <param name="bootstrapper">The bootstrapper.</param>
21-
public void Load(IServiceCollection? bootstrapper)
22-
{
23-
if (bootstrapper is null)
24-
return;
25-
bootstrapper.AddTransient<SQLHelper>();
26-
}
21+
public void Load(IServiceCollection? bootstrapper) => bootstrapper?.RegisterSQLHelper();
2722
}
2823
}

src/SQLHelper.DB/Registration/Register.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public static class RegistrationExtensions
4343
/// <returns>The service collection with SQLHelper registered.</returns>
4444
public static IServiceCollection? RegisterSQLHelper(this IServiceCollection? services)
4545
{
46+
if (services.Exists<SQLHelper>())
47+
return services;
4648
return services?.AddTransient<SQLHelper>()
4749
?.RegisterBigBookOfDataTypes();
4850
}

0 commit comments

Comments
 (0)