Skip to content

Commit

Permalink
fix: Update .editorconfig and refactor SQLHelper registration
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JaCraig committed Nov 24, 2024
1 parent fab0379 commit c0fd16e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
8 changes: 5 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ csharp_style_prefer_pattern_matching = true
csharp_style_prefer_switch_expression = true

# Null-checking preferences
csharp_style_conditional_delegate_call = true
csharp_style_conditional_delegate_call = true:suggestion

# Modifier preferences
csharp_prefer_static_local_function = true
Expand Down Expand Up @@ -135,7 +135,7 @@ csharp_using_directive_placement = outside_namespace:silent
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
csharp_style_allow_embedded_statements_on_same_line_experimental = true

Expand Down Expand Up @@ -285,4 +285,6 @@ end_of_line = crlf
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_namespace_match_folder = false:suggestion
dotnet_style_namespace_match_folder = false:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = false:silent
dotnet_style_prefer_conditional_expression_over_return = false:silent
7 changes: 1 addition & 6 deletions src/SQLHelper.DB/CanisterModules/SQLHelperModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public class SQLHelperModule : IModule
/// Loads the module using the bootstrapper
/// </summary>
/// <param name="bootstrapper">The bootstrapper.</param>
public void Load(IServiceCollection? bootstrapper)
{
if (bootstrapper is null)
return;
bootstrapper.AddTransient<SQLHelper>();
}
public void Load(IServiceCollection? bootstrapper) => bootstrapper?.RegisterSQLHelper();
}
}
2 changes: 2 additions & 0 deletions src/SQLHelper.DB/Registration/Register.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public static class RegistrationExtensions
/// <returns>The service collection with SQLHelper registered.</returns>
public static IServiceCollection? RegisterSQLHelper(this IServiceCollection? services)
{
if (services.Exists<SQLHelper>())
return services;
return services?.AddTransient<SQLHelper>()
?.RegisterBigBookOfDataTypes();
}
Expand Down

0 comments on commit c0fd16e

Please sign in to comment.