From b15b13b039d2733149efdde277824eec40980abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stano=20Pe=C5=A5ko?= Date: Tue, 25 Jun 2019 17:47:15 +0200 Subject: [PATCH 01/15] Fixed project file, .editorconfig and .gitignore --- .editorconfig | 249 ++++++++++++++++++++++++---- .gitignore | 4 - src/Kros.KORM.Extensions.Asp.csproj | 26 ++- 3 files changed, 228 insertions(+), 51 deletions(-) diff --git a/.editorconfig b/.editorconfig index 4dc5335..6c69d7a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,53 +1,238 @@ +# Remove the line below if you want to inherit .editorconfig settings from higher directories root = true # All files [*] -indent_style = space +indent_style = space +tab_width = 4 trim_trailing_whitespace = true + +# Markdown files +[*.md] +trim_trailing_whitespace = false + + # Code files [*.{cs,csx,vb,vbx}] -indent_size = 4 +tab_width = 4 +indent_size = 4 +indent_style = space insert_final_newline = true -charset = utf-8-bom +charset = utf-8-bom -############################### -# .NET Coding Conventions # -############################### + +# .NET Coding Conventions [*.{cs,vb}] + +#### Core EditorConfig Options #### + +# New line preferences +end_of_line = crlf + +#### .NET Coding Conventions #### + # Organize usings -dotnet_sort_system_directives_first = false +dotnet_separate_import_directive_groups = false +dotnet_sort_system_directives_first = false -# this. preferences -dotnet_style_qualification_for_field = false : suggestion -dotnet_style_qualification_for_property = false : suggestion -dotnet_style_qualification_for_method = false : suggestion -dotnet_style_qualification_for_event = false : suggestion +# this. and Me. preferences +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent # Language keywords vs BCL types preferences -dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion -dotnet_style_predefined_type_for_member_access = true : suggestion +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent # Expression-level preferences -dotnet_style_object_initializer = true : suggestion -dotnet_style_collection_initializer = true : suggestion -dotnet_style_explicit_tuple_names = true : warning -dotnet_style_coalesce_expression = true : suggestion -dotnet_style_null_propagation = true : suggestion - -############################### -# C# Coding Conventions # -############################### -[*.cs] -# Expression-level preferences -csharp_prefer_braces = true : suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_throw_expression = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:suggestion + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:warning + +#### C# Coding Conventions #### # var preferences -csharp_style_var_when_type_is_apparent = true : suggestion -csharp_style_var_elsewhere = false : suggestion +csharp_style_var_elsewhere = false:suggestion +csharp_style_var_for_built_in_types = false:suggestion +csharp_style_var_when_type_is_apparent = true:suggestion # Expression-bodied members -csharp_style_expression_bodied_properties = true : suggestion -csharp_style_expression_bodied_methods = true : suggestion -csharp_style_expression_bodied_indexers = true : suggestion -csharp_style_expression_bodied_accessors = true : suggestion +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = true:silent +csharp_style_expression_bodied_operators = true:silent +csharp_style_expression_bodied_properties = true:silent + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_prefer_static_local_function = true:suggestion +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async + +# Code-block preferences +csharp_prefer_braces = true:suggestion +csharp_prefer_simple_using_statement = false:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:warning + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = false +csharp_indent_labels = flush_left +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +#### Naming styles #### + +# Naming styles + +dotnet_naming_style.pascal_case_style.required_prefix = +dotnet_naming_style.pascal_case_style.required_suffix = +dotnet_naming_style.pascal_case_style.word_separator = +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +dotnet_naming_style.interface_style.required_prefix = I +dotnet_naming_style.interface_style.required_suffix = +dotnet_naming_style.interface_style.word_separator = +dotnet_naming_style.interface_style.capitalization = pascal_case + +dotnet_naming_style.field_style.required_prefix = _ +dotnet_naming_style.field_style.required_suffix = +dotnet_naming_style.field_style.word_separator = +dotnet_naming_style.field_style.capitalization = camel_case + +# Naming rules + +# Use "I" prefix for interfaces +dotnet_naming_symbols.interface.applicable_kinds = interface +dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal +dotnet_naming_symbols.interface.required_modifiers = +dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning +dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface +dotnet_naming_rule.interface_should_be_begins_with_i.style = interface_style + +# Use PascalCase for constants +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.applicable_accessibilities = public, internal, private, protected, protected_internal +dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style + +# Use PascalCase for types +dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum +dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal +dotnet_naming_symbols.types.required_modifiers = +dotnet_naming_rule.types_should_be_pascal_case.severity = warning +dotnet_naming_rule.types_should_be_pascal_case.symbols = types +dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case_style + +# Use PascalCase for properties, methods and events +dotnet_naming_symbols.non_field_members.applicable_kinds = property, method, event +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal +dotnet_naming_symbols.non_field_members.required_modifiers = +dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning +dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case_style + +# Use "_" prefix for private and internal fields (except constants) +dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private +dotnet_naming_symbols.private_or_internal_field.required_modifiers = +dotnet_naming_rule.private_or_internal_field_should_be_field_name.severity = warning +dotnet_naming_rule.private_or_internal_field_should_be_field_name.symbols = private_or_internal_field +dotnet_naming_rule.private_or_internal_field_should_be_field_name.style = field_style + +# Use "_" prefix for private and internal static fields +dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field +dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private +dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static +dotnet_naming_rule.private_or_internal_static_field_should_be_field_name.severity = warning +dotnet_naming_rule.private_or_internal_static_field_should_be_field_name.symbols = private_or_internal_static_field +dotnet_naming_rule.private_or_internal_static_field_should_be_field_name.style = field_style diff --git a/.gitignore b/.gitignore index e020d30..cbb33f4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,6 @@ # CodeRush .cr -# XML documentation files -Kros.Utils.xml -Kros.KORM.xml - # User-specific files *.suo *.user diff --git a/src/Kros.KORM.Extensions.Asp.csproj b/src/Kros.KORM.Extensions.Asp.csproj index 253ed4c..2db6076 100644 --- a/src/Kros.KORM.Extensions.Asp.csproj +++ b/src/Kros.KORM.Extensions.Asp.csproj @@ -2,24 +2,23 @@ netcoreapp2.1 - KROS a.s. + KROS a. s. 1.1.0-alfa - KROS a.s. - Kros.KORM - This package contains extensios for project Kros.KORM for AspNet Core projects. - Copyright © KROS a.s. + KROS a. s. + Kros.KORM.Extensions.Asp + Extensions for Kros.KORM library for ASP.NET Core projects. + Copyright © KROS a. s. true - Kros.KORM.Extensions.Asp Kros.KORM.Extensions.Asp + Kros.KORM.Extensions.Asp + Kros.KORM.Extensions.Asp Kros.KORM.Extensions.Asp - bin\Release\Kros.KORM.xml + true Kros.KORM.Extensions.Asp - https://github.com/Kros-sk/Kros.Libs/blob/master/Kros.KORM.Extensions.Asp/README.md - - Kros;KORM;Asp.Net Core;Kros.KORM - + https://github.com/Kros-sk/Kros.KORM.Extensions.Asp + Kros;KORM;ASP.NET Core;Kros.KORM MIT https://en.gravatar.com/userimage/137934964/524e95fbd8c2e8779e02819ab6902bef.png https://github.com/Kros-sk/Kros.KORM.Extensions.Asp @@ -27,10 +26,7 @@ - bin\Debug\ - - - bin\Release\ + DEBUG;TRACE From e6bc3853814021999c479b994fe04a295af81c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stano=20Pe=C5=A5ko?= Date: Mon, 1 Jul 2019 19:52:13 +0200 Subject: [PATCH 02/15] Small fixes to remove warnings and infos --- src/KormBuilder.cs | 15 ++++++++------- src/Migrations/Middleware/MigrationsMiddleware.cs | 15 ++++++++------- src/ServiceCollectionExtensions.cs | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/KormBuilder.cs b/src/KormBuilder.cs index eec34b6..2afe459 100644 --- a/src/KormBuilder.cs +++ b/src/KormBuilder.cs @@ -17,8 +17,8 @@ namespace Kros.KORM.Extensions.Asp /// public class KormBuilder { - private ConnectionStringSettings _connectionString; - private IDatabaseBuilder _builder; + private readonly ConnectionStringSettings _connectionString; + private readonly IDatabaseBuilder _builder; /// /// Initializes a new instance of the class. @@ -69,9 +69,10 @@ public KormBuilder UseDatabaseConfiguration(DatabaseConfigurationBase databaseCo /// This instance. public KormBuilder InitDatabaseForIdGenerator() { - var factory = IdGeneratorFactories.GetFactory(_connectionString.ConnectionString, _connectionString.ProviderName); + IIdGeneratorFactory factory = IdGeneratorFactories.GetFactory( + _connectionString.ConnectionString, _connectionString.ProviderName); - using (var idGenerator = factory.GetGenerator(string.Empty)) + using (IIdGenerator idGenerator = factory.GetGenerator(string.Empty)) { idGenerator.InitDatabaseForIdGenerator(); } @@ -96,7 +97,7 @@ public KormBuilder AddKormMigrations( { IConfigurationSection migrationsConfig = GetMigrationsSection(configuration); _autoMigrate = migrationsConfig.GetValue(AutoMigrateSectionName, false); - var connectionString = migrationsConfig + ConnectionStringSettings connectionString = migrationsConfig .GetSection(ConnectionStringSectionName).Get(); Services @@ -115,7 +116,7 @@ public KormBuilder AddKormMigrations( private static MigrationOptions SetupMigrationOptions(Action setupAction) { - MigrationOptions options = new MigrationOptions(); + var options = new MigrationOptions(); if (setupAction != null) { @@ -131,7 +132,7 @@ private static MigrationOptions SetupMigrationOptions(Action s private static IConfigurationSection GetMigrationsSection(IConfiguration configuration) { - var migrationsConfig = configuration.GetSection(MigrationSectionName); + IConfigurationSection migrationsConfig = configuration.GetSection(MigrationSectionName); if (!migrationsConfig.Exists()) { throw new InvalidOperationException( diff --git a/src/Migrations/Middleware/MigrationsMiddleware.cs b/src/Migrations/Middleware/MigrationsMiddleware.cs index 45ce3c1..809c158 100644 --- a/src/Migrations/Middleware/MigrationsMiddleware.cs +++ b/src/Migrations/Middleware/MigrationsMiddleware.cs @@ -12,7 +12,9 @@ public class MigrationsMiddleware { private const string WasMigrationExecutedKey = "WasMigrationExecuted"; +#pragma warning disable IDE0052 // Remove unread private members private readonly RequestDelegate _next; +#pragma warning restore IDE0052 // Remove unread private members private readonly MigrationMiddlewareOptions _options; private readonly IMemoryCache _cache; @@ -32,30 +34,29 @@ public MigrationsMiddleware( _cache = Check.NotNull(cache, nameof(cache)); } +#pragma warning disable IDE0060 // Remove unused parameter /// /// Invokes the specified context. /// /// The context. /// Migrations runner. - public async Task Invoke( - HttpContext context, - IMigrationsRunner migrationsRunner) + public async Task Invoke(HttpContext context, IMigrationsRunner migrationsRunner) { if (CanMigrate()) { SetupCache(); - await migrationsRunner.MigrateAsync(); } } +#pragma warning restore IDE0060 // Remove unused parameter private bool CanMigrate() - => !_cache.TryGetValue(WasMigrationExecutedKey, out var migrated) || !migrated; + => !_cache.TryGetValue(WasMigrationExecutedKey, out bool migrated) || !migrated; private void SetupCache() { - var options = new MemoryCacheEntryOptions() - .SetSlidingExpiration(_options.SlidingExpirationBetweenMigrations); + var options = new MemoryCacheEntryOptions(); + options.SetSlidingExpiration(_options.SlidingExpirationBetweenMigrations); _cache.Set(WasMigrationExecutedKey, true, options); } } diff --git a/src/ServiceCollectionExtensions.cs b/src/ServiceCollectionExtensions.cs index 3b31e36..4329b8a 100644 --- a/src/ServiceCollectionExtensions.cs +++ b/src/ServiceCollectionExtensions.cs @@ -80,7 +80,7 @@ public static KormBuilder AddKorm(this IServiceCollection services, IConfigurati string.Format(Resources.ConfigurationSectionIsMissing, configurationSection.Key)); } - var connectionString = configurationSection.Get(); + ConnectionStringSettings connectionString = configurationSection.Get(); CheckOptions(connectionString); var builder = new KormBuilder(services, connectionString); From d99c763c9b27b761a962fd3061855dbf7daf64b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stano=20Pe=C5=A5ko?= Date: Tue, 2 Jul 2019 17:44:42 +0200 Subject: [PATCH 03/15] Updated projects to .NET Core 2.2 and packages --- src/Kros.KORM.Extensions.Asp.csproj | 14 ++++++------ .../Kros.KORM.Extensions.Api.UnitTests.csproj | 22 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Kros.KORM.Extensions.Asp.csproj b/src/Kros.KORM.Extensions.Asp.csproj index 2db6076..85a0a64 100644 --- a/src/Kros.KORM.Extensions.Asp.csproj +++ b/src/Kros.KORM.Extensions.Asp.csproj @@ -1,7 +1,7 @@  - netcoreapp2.1 + netcoreapp2.2 KROS a. s. 1.1.0-alfa KROS a. s. @@ -31,12 +31,12 @@ - - - - - - + + + + + + diff --git a/tests/Kros.KORM.Extensions.Api.UnitTests.csproj b/tests/Kros.KORM.Extensions.Api.UnitTests.csproj index 0db7408..f0f7da0 100644 --- a/tests/Kros.KORM.Extensions.Api.UnitTests.csproj +++ b/tests/Kros.KORM.Extensions.Api.UnitTests.csproj @@ -1,22 +1,24 @@  - netcoreapp2.1 - + netcoreapp2.2 false - + - - - + + + - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + From 51432c2de6d8f63cfc7dd20062daa4177eb5afb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stano=20Pe=C5=A5ko?= Date: Tue, 2 Jul 2019 21:25:50 +0200 Subject: [PATCH 04/15] Implemented named connection strings in appsettings --- src/KormBuilder.cs | 72 +++++------ src/ServiceCollectionExtensions.cs | 113 +++++++---------- tests/ConfigurationHelper.cs | 8 +- tests/IntegrationTestConfig.cs | 10 -- tests/KormBuilderShould.cs | 116 ++++++------------ tests/KormBuilderWithDatabaseShould.cs | 54 ++++++++ .../Kros.KORM.Extensions.Api.UnitTests.csproj | 9 -- tests/ServiceCollectionExtensionsShould.cs | 48 ++++++-- tests/appsettings.autoupdateoff.json | 27 ---- tests/appsettings.json | 19 +++ tests/appsettings.missingsection.json | 15 --- tests/appsettings.standard.json | 27 ---- 12 files changed, 227 insertions(+), 291 deletions(-) delete mode 100644 tests/IntegrationTestConfig.cs create mode 100644 tests/KormBuilderWithDatabaseShould.cs delete mode 100644 tests/appsettings.autoupdateoff.json create mode 100644 tests/appsettings.json delete mode 100644 tests/appsettings.missingsection.json delete mode 100644 tests/appsettings.standard.json diff --git a/src/KormBuilder.cs b/src/KormBuilder.cs index 2afe459..08885df 100644 --- a/src/KormBuilder.cs +++ b/src/KormBuilder.cs @@ -1,14 +1,10 @@ using Kros.Data; -using Kros.KORM.Extensions.Asp.Properties; using Kros.KORM.Migrations; using Kros.KORM.Migrations.Middleware; using Kros.KORM.Migrations.Providers; using Kros.Utils; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; -using System.Configuration; -using System.Threading.Tasks; namespace Kros.KORM.Extensions.Asp { @@ -17,21 +13,36 @@ namespace Kros.KORM.Extensions.Asp /// public class KormBuilder { - private readonly ConnectionStringSettings _connectionString; + public const string DefaultConnectionStringName = "DefaultConnection"; + internal const string DefaultProviderName = Kros.Data.SqlServer.SqlServerDataHelper.ClientId; + internal const bool DefaultAutoMigrate = false; + private readonly IDatabaseBuilder _builder; + public KormBuilder(IServiceCollection services, string connectionString) + : this(services, connectionString, DefaultAutoMigrate, DefaultProviderName) + { + } + + public KormBuilder(IServiceCollection services, string connectionString, bool autoMigrate) + : this(services, connectionString, autoMigrate, DefaultProviderName) + { + } + /// /// Initializes a new instance of the class. /// /// The service collection. /// The connection string settings. - public KormBuilder(IServiceCollection services, ConnectionStringSettings connectionString) + public KormBuilder(IServiceCollection services, string connectionString, bool autoMigrate, string kormProvider) { Services = Check.NotNull(services, nameof(services)); - _connectionString = Check.NotNull(connectionString, nameof(connectionString)); + ConnectionString = Check.NotNullOrWhiteSpace(connectionString, nameof(connectionString)); + KormProvider = Check.NotNullOrWhiteSpace(kormProvider, nameof(kormProvider)); + AutoMigrate = autoMigrate; _builder = Database.Builder; - _builder.UseConnection(connectionString); + _builder.UseConnection(connectionString, kormProvider); } /// @@ -39,6 +50,10 @@ public KormBuilder(IServiceCollection services, ConnectionStringSettings connect /// public IServiceCollection Services { get; } + internal string ConnectionString { get; } + internal string KormProvider { get; } + internal bool AutoMigrate { get; } + /// /// Use database configuration. /// @@ -47,7 +62,6 @@ public KormBuilder(IServiceCollection services, ConnectionStringSettings connect public KormBuilder UseDatabaseConfiguration() where TConfiguration : DatabaseConfigurationBase, new() { _builder.UseDatabaseConfiguration(); - return this; } @@ -59,7 +73,6 @@ public KormBuilder(IServiceCollection services, ConnectionStringSettings connect public KormBuilder UseDatabaseConfiguration(DatabaseConfigurationBase databaseConfiguration) { _builder.UseDatabaseConfiguration(databaseConfiguration); - return this; } @@ -69,45 +82,28 @@ public KormBuilder UseDatabaseConfiguration(DatabaseConfigurationBase databaseCo /// This instance. public KormBuilder InitDatabaseForIdGenerator() { - IIdGeneratorFactory factory = IdGeneratorFactories.GetFactory( - _connectionString.ConnectionString, _connectionString.ProviderName); - + IIdGeneratorFactory factory = IdGeneratorFactories.GetFactory(ConnectionString, KormProvider); using (IIdGenerator idGenerator = factory.GetGenerator(string.Empty)) { idGenerator.InitDatabaseForIdGenerator(); } - return this; } - private const string MigrationSectionName = "KormMigrations"; - private const string ConnectionStringSectionName = "ConnectionString"; - private const string AutoMigrateSectionName = "AutoMigrate"; - private bool _autoMigrate = false; - /// /// Adds configuration for into . /// /// The configuration. /// Setup migration options. /// This instance of . - public KormBuilder AddKormMigrations( - IConfiguration configuration, - Action setupAction = null) + public KormBuilder AddKormMigrations(Action setupAction = null) { - IConfigurationSection migrationsConfig = GetMigrationsSection(configuration); - _autoMigrate = migrationsConfig.GetValue(AutoMigrateSectionName, false); - ConnectionStringSettings connectionString = migrationsConfig - .GetSection(ConnectionStringSectionName).Get(); - Services .AddMemoryCache() - .AddTransient((Func)((s) => + .AddTransient((Func)(s => { - var database = new Database(connectionString); - + var database = new Database(ConnectionString, KormProvider); MigrationOptions options = SetupMigrationOptions(setupAction); - return new MigrationsRunner(database, options); })); @@ -130,24 +126,12 @@ private static MigrationOptions SetupMigrationOptions(Action s return options; } - private static IConfigurationSection GetMigrationsSection(IConfiguration configuration) - { - IConfigurationSection migrationsConfig = configuration.GetSection(MigrationSectionName); - if (!migrationsConfig.Exists()) - { - throw new InvalidOperationException( - string.Format(Resources.ConfigurationSectionIsMissing, MigrationSectionName)); - } - - return migrationsConfig; - } - /// /// Execute database migration. /// public void Migrate() { - if (_autoMigrate) + if (AutoMigrate) { Services.BuildServiceProvider() .GetService() diff --git a/src/ServiceCollectionExtensions.cs b/src/ServiceCollectionExtensions.cs index 4329b8a..efc6774 100644 --- a/src/ServiceCollectionExtensions.cs +++ b/src/ServiceCollectionExtensions.cs @@ -1,10 +1,8 @@ -using Kros.Extensions; -using Kros.KORM.Extensions.Asp.Properties; -using Kros.Utils; +using Kros.Utils; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; -using System.Configuration; +using System.Data.Common; namespace Kros.KORM.Extensions.Asp { @@ -19,89 +17,68 @@ namespace Kros.KORM.Extensions.Asp /// public static class ServiceCollectionExtensions { - private const string ConnectionStringSectionName = "ConnectionString"; + public const string KormProviderKey = "KormProvider"; + public const string KormAutoMigrateKey = "KormAutoMigrate"; - /// - /// Register KORM into DI container. - /// - /// The service collection. - /// The configuration. - /// for initialization. - /// - /// - /// - /// If 'ConnectionString' section is missing in configuration file. - /// - /// - /// If or - /// are not filled. - /// - /// - /// - /// - /// If or is ; - /// public static KormBuilder AddKorm(this IServiceCollection services, IConfiguration configuration) - { - Check.NotNull(configuration, nameof(configuration)); - Check.NotNull(services, nameof(services)); + => AddKorm(services, configuration.GetConnectionString(KormBuilder.DefaultConnectionStringName)); - return AddKorm(services, configuration.GetSection(ConnectionStringSectionName)); - } + public static KormBuilder AddKorm( + this IServiceCollection services, + IConfiguration configuration, + string connectionStringName) + => AddKorm(services, configuration.GetConnectionString(connectionStringName)); - /// - /// Register KORM into DI container. - /// - /// The service collection. - /// The configuration section. - /// for initialization. - /// - /// - /// - /// If doesn't exist in configuration file. - /// - /// - /// If or - /// are not filled. - /// - /// - /// - /// - /// When or is null; - /// - public static KormBuilder AddKorm(this IServiceCollection services, IConfigurationSection configurationSection) + public static KormBuilder AddKorm(this IServiceCollection services, string connectionString) { Check.NotNull(services, nameof(services)); - Check.NotNull(configurationSection, nameof(configurationSection)); + Check.NotNullOrWhiteSpace(connectionString, nameof(connectionString)); - if (!configurationSection.Exists()) + var cnstrBuilder = new DbConnectionStringBuilder { - throw new InvalidOperationException( - string.Format(Resources.ConfigurationSectionIsMissing, configurationSection.Key)); - } - - ConnectionStringSettings connectionString = configurationSection.Get(); - CheckOptions(connectionString); - var builder = new KormBuilder(services, connectionString); + ConnectionString = connectionString + }; + string providerName = GetKormProvider(cnstrBuilder); + bool autoMigrate = GetKormAutoMigrate(cnstrBuilder); + connectionString = cnstrBuilder.ConnectionString; // Previous methods remove keys, so we want clean connection string. - services.AddScoped((serviceProvider) => + if (string.IsNullOrWhiteSpace(connectionString)) { - return builder.Build(); - }); + // RES: + throw new ArgumentException("Connection string contained only KORM keys. These were removed and so connection is empty.", nameof(connectionString)); + } + + var builder = new KormBuilder(services, connectionString, autoMigrate, providerName); + services.AddScoped(serviceProvider => builder.Build()); return builder; } - private static void CheckOptions(ConnectionStringSettings connectionString) + private static string GetKormProvider(DbConnectionStringBuilder cnstrBuilder) { - if (connectionString.ConnectionString.IsNullOrWhiteSpace()) + if (cnstrBuilder.TryGetValue(KormProviderKey, out object cnstrProviderName)) { - throw new InvalidOperationException(Resources.ConnectionStringIsRequired); + cnstrBuilder.Remove(KormProviderKey); + string providerName = (string)cnstrProviderName; + if (!string.IsNullOrWhiteSpace(providerName)) + { + return providerName; + }; } - if (connectionString.ProviderName.IsNullOrWhiteSpace()) + return KormBuilder.DefaultProviderName; + } + + private static bool GetKormAutoMigrate(DbConnectionStringBuilder cnstrBuilder) + { + if (cnstrBuilder.TryGetValue(KormAutoMigrateKey, out object cnstrAutoMigrate)) { - throw new InvalidOperationException(Resources.ProviderNameIsRequired); + cnstrBuilder.Remove(KormAutoMigrateKey); + if (bool.TryParse((string)cnstrAutoMigrate, out bool autoMigrate)) + { + return autoMigrate; + } } + return KormBuilder.DefaultAutoMigrate; } } } diff --git a/tests/ConfigurationHelper.cs b/tests/ConfigurationHelper.cs index 3f8df16..1df94b5 100644 --- a/tests/ConfigurationHelper.cs +++ b/tests/ConfigurationHelper.cs @@ -1,14 +1,10 @@ using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; namespace Kros.KORM.Extensions.Api.UnitTests { internal class ConfigurationHelper { - private static IConfigurationRoot GetConfiguration(string configName) - => new ConfigurationBuilder().AddJsonFile($"appsettings.{configName}.json").Build(); - - public static (IConfigurationRoot configuration, IServiceCollection services) CreateHelpers(string configName) - => (GetConfiguration(configName), new ServiceCollection()); + public static IConfigurationRoot GetConfiguration() + => new ConfigurationBuilder().AddJsonFile("appsettings.json").Build(); } } diff --git a/tests/IntegrationTestConfig.cs b/tests/IntegrationTestConfig.cs deleted file mode 100644 index e507690..0000000 --- a/tests/IntegrationTestConfig.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Kros.KORM.Extensions.Api.UnitTests -{ - internal static class IntegrationTestConfig - { - internal static string ConnectionString - { - get => "Server=CENSQL\\SQL16ENT; User ID=KrosPlus;PWD=7040; Persist Security Info = 'TRUE'"; - } - } -} diff --git a/tests/KormBuilderShould.cs b/tests/KormBuilderShould.cs index fbb2e27..d475dda 100644 --- a/tests/KormBuilderShould.cs +++ b/tests/KormBuilderShould.cs @@ -1,128 +1,92 @@ using FluentAssertions; -using Kros.Data; using Kros.KORM.Extensions.Asp; using Kros.KORM.Metadata; using Kros.KORM.Migrations; -using Kros.UnitTests; using Microsoft.Extensions.DependencyInjection; using NSubstitute; using System; -using System.Configuration; using Xunit; namespace Kros.KORM.Extensions.Api.UnitTests { - public class KormBuilderShould : SqlServerDatabaseTestBase + public class KormBuilderShould { - protected override string BaseConnectionString - => IntegrationTestConfig.ConnectionString; - - [Fact] - public void InitDatabaseForIdGenerator() + [Theory] + [InlineData(typeof(string))] + public void asdf(Type t) { - KormBuilder kormBuilder = CreateKormBuilder(); - kormBuilder.InitDatabaseForIdGenerator(); - CheckTableAndProcedure(); } - private KormBuilder CreateKormBuilder() + [Fact] + public void ThrowArgumentExceptionWhenArgumentsAreInvalid() { - var connectionSettings = new ConnectionStringSettings( - "Default", - ServerHelper.Connection.ConnectionString, - "System.Data.SqlClient"); + const string connectionString = "server=localhost"; + var services = new ServiceCollection(); - var kormBuilder = new KormBuilder(new ServiceCollection(), connectionSettings); + Action action = () => new KormBuilder(null, connectionString); + action.Should().Throw().And.ParamName.Should().Be("services"); - return kormBuilder; - } + action = () => new KormBuilder(services, null); + action.Should().Throw().And.ParamName.Should().Be("connectionString"); - [Fact] - public void ThrowExceptionWhenAddMigrationsWithoutConfigurationSection() - { - var kormBuilder = CreateKormBuilder(); - var (configuration, _) = ConfigurationHelper.CreateHelpers("missingsection"); + action = () => new KormBuilder(services, string.Empty); + action.Should().Throw().And.ParamName.Should().Be("connectionString"); + + action = () => new KormBuilder(services, " \t "); + action.Should().Throw().And.ParamName.Should().Be("connectionString"); + + action = () => new KormBuilder(services, connectionString, false, null); + action.Should().Throw().And.ParamName.Should().Be("kormProvider"); - Action action = () => - { - kormBuilder.AddKormMigrations(configuration); - }; + action = () => new KormBuilder(services, connectionString, false, string.Empty); + action.Should().Throw().And.ParamName.Should().Be("kormProvider"); - action.Should() - .Throw() - .WithMessage("*Configuration section 'KormMigrations' is missing.*"); + action = () => new KormBuilder(services, connectionString, false, " \t "); + action.Should().Throw().And.ParamName.Should().Be("kormProvider"); } [Fact] public void AddMigrationsToContainer() { - var kormBuilder = CreateKormBuilder(); - var (configuration, _) = ConfigurationHelper.CreateHelpers("standard"); - - kormBuilder.AddKormMigrations(configuration); + KormBuilder kormBuilder = CreateKormBuilder(false); + kormBuilder.AddKormMigrations(); kormBuilder.Services.BuildServiceProvider() .GetService() .Should().NotBeNull(); } - [Fact] - public void ExecuteMigrations() - { - var kormBuilder = CreateKormBuilder(); - var (configuration, _) = ConfigurationHelper.CreateHelpers("standard"); - - kormBuilder.AddKormMigrations(configuration); - var migrationRunner = Substitute.For(); - kormBuilder.Services.AddSingleton(migrationRunner); - - kormBuilder.Migrate(); - - migrationRunner.Received().MigrateAsync(); - } - - [Fact] - public void NotExecuteMigrationsWhenAutoUpgrateIsOff() + [Theory] + [InlineData(true, 1)] + [InlineData(false, 0)] + public void ExecuteMigrationsBasedOnAutoMigrateValue(bool autoMigrate, int migrateCallCount) { - var kormBuilder = CreateKormBuilder(); - var (configuration, _) = ConfigurationHelper.CreateHelpers("autoupdateoff"); + KormBuilder kormBuilder = CreateKormBuilder(autoMigrate); + kormBuilder.AddKormMigrations(); - kormBuilder.AddKormMigrations(configuration); - var migrationRunner = Substitute.For(); - kormBuilder.Services.AddSingleton(migrationRunner); + IMigrationsRunner migrationRunner = Substitute.For(); + kormBuilder.Services.AddSingleton(migrationRunner); kormBuilder.Migrate(); - migrationRunner.DidNotReceive().MigrateAsync(); + migrationRunner.Received(migrateCallCount).MigrateAsync(); } [Fact] public void UseDatabaseConfiguration() { - var kormBuilder = CreateKormBuilder(); - var configuration = Substitute.For(); + KormBuilder kormBuilder = CreateKormBuilder(false); + DatabaseConfigurationBase configuration = Substitute.For(); kormBuilder.UseDatabaseConfiguration(configuration); - var database = kormBuilder.Build(); + IDatabase database = kormBuilder.Build(); database.Should().NotBeNull(); configuration.Received().OnModelCreating(Arg.Any()); } - private void CheckTableAndProcedure() - { - using (ConnectionHelper.OpenConnection(ServerHelper.Connection)) - using (var cmd = ServerHelper.Connection.CreateCommand()) - { - cmd.CommandText = "SELECT Count(*) FROM sys.tables WHERE name = 'IdStore' AND type = 'U'"; - ((int)cmd.ExecuteScalar()) - .Should().Be(1); - - cmd.CommandText = "SELECT Count(*) FROM sys.procedures WHERE name = 'spGetNewId' AND type = 'P'"; - ((int)cmd.ExecuteScalar()) - .Should().Be(1); - } - } + private KormBuilder CreateKormBuilder(bool autoMigrate) + => new KormBuilder(new ServiceCollection(), "server=localhost", autoMigrate); } } diff --git a/tests/KormBuilderWithDatabaseShould.cs b/tests/KormBuilderWithDatabaseShould.cs new file mode 100644 index 0000000..b042873 --- /dev/null +++ b/tests/KormBuilderWithDatabaseShould.cs @@ -0,0 +1,54 @@ +using FluentAssertions; +using Kros.Data; +using Kros.KORM.Extensions.Asp; +using Kros.UnitTests; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using System.Data.SqlClient; +using Xunit; + +namespace Kros.KORM.Extensions.Api.UnitTests +{ + public class KormBuilderWithDatabaseShould : SqlServerDatabaseTestBase + { + private string _connectionString; + + protected override string BaseConnectionString + { + get + { + if (_connectionString is null) + { + IConfigurationRoot configuration = ConfigurationHelper.GetConfiguration(); + _connectionString = configuration.GetConnectionString("IdGenerator"); + } + return _connectionString; + } + } + + [Fact] + public void InitDatabaseForIdGenerator() + { + KormBuilder kormBuilder = CreateKormBuilder(false); + kormBuilder.InitDatabaseForIdGenerator(); + + CheckTableAndProcedure(); + } + + private KormBuilder CreateKormBuilder(bool autoMigrate) + => new KormBuilder(new ServiceCollection(), ServerHelper.Connection.ConnectionString, autoMigrate); + + private void CheckTableAndProcedure() + { + using (ConnectionHelper.OpenConnection(ServerHelper.Connection)) + using (SqlCommand cmd = ServerHelper.Connection.CreateCommand()) + { + cmd.CommandText = "SELECT Count(*) FROM sys.tables WHERE name = 'IdStore' AND type = 'U'"; + ((int)cmd.ExecuteScalar()).Should().Be(1); + + cmd.CommandText = "SELECT Count(*) FROM sys.procedures WHERE name = 'spGetNewId' AND type = 'P'"; + ((int)cmd.ExecuteScalar()).Should().Be(1); + } + } + } +} diff --git a/tests/Kros.KORM.Extensions.Api.UnitTests.csproj b/tests/Kros.KORM.Extensions.Api.UnitTests.csproj index f0f7da0..b2ff960 100644 --- a/tests/Kros.KORM.Extensions.Api.UnitTests.csproj +++ b/tests/Kros.KORM.Extensions.Api.UnitTests.csproj @@ -26,18 +26,9 @@ - - PreserveNewest - PreserveNewest - - PreserveNewest - - - PreserveNewest - diff --git a/tests/ServiceCollectionExtensionsShould.cs b/tests/ServiceCollectionExtensionsShould.cs index eaea54f..2402181 100644 --- a/tests/ServiceCollectionExtensionsShould.cs +++ b/tests/ServiceCollectionExtensionsShould.cs @@ -1,5 +1,6 @@ -using FluentAssertions; +using FluentAssertions; using Kros.KORM.Extensions.Asp; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System; using Xunit; @@ -11,9 +12,9 @@ public class ServiceCollectionExtensionsShould [Fact] public void AddKormToContainer() { - var (configuration, services) = ConfigurationHelper.CreateHelpers("standard"); + var services = new ServiceCollection(); - services.AddKorm(configuration); + services.AddKorm("server=localhost"); services.BuildServiceProvider() .GetService() @@ -21,18 +22,47 @@ public void AddKormToContainer() } [Fact] - public void ThrowExceptionWhenConfigurationSectionIsMissing() + public void UseDefaultConnectionStringIfConfigurationIsProvided() { - var (configuration, services) = ConfigurationHelper.CreateHelpers("missingsection"); + IConfigurationRoot configuration = ConfigurationHelper.GetConfiguration(); + var services = new ServiceCollection(); + KormBuilder builder = services.AddKorm(configuration); + + builder.ConnectionString.Should().Be(configuration.GetConnectionString("DefaultConnection")); + } + + [Fact] + public void ThrowArgumentExceptionIfConnectionStringContainsOnlyKormValues() + { Action action = () => { - services.AddKorm(configuration); + var services = new ServiceCollection(); + services.AddKorm("KormProvider=LoremIpsum;KormAutoMigrate=false"); }; - action.Should() - .Throw() - .WithMessage("*Configuration section 'ConnectionString' is missing.*"); + action.Should().Throw().And.ParamName.Should().Be("connectionString"); + } + + [Theory] + [InlineData("server=localhost;", KormBuilder.DefaultProviderName, false)] + [InlineData("server=localhost;KormProvider=", KormBuilder.DefaultProviderName, false)] + [InlineData("server=localhost;KormProvider=' \t '", KormBuilder.DefaultProviderName, false)] + [InlineData("server=localhost;KormProvider=LoremIpsum", "LoremIpsum", false)] + [InlineData("server=localhost;KormAutoMigrate=true", KormBuilder.DefaultProviderName, true)] + [InlineData("server=localhost;KormAutoMigrate=false", KormBuilder.DefaultProviderName, false)] + [InlineData("server=localhost;KormAutoMigrate=InvalidValue", KormBuilder.DefaultProviderName, false)] + [InlineData("server=localhost;KormAutoMigrate=", KormBuilder.DefaultProviderName, false)] + [InlineData("server=localhost;KormAutoMigrate=' \t '", KormBuilder.DefaultProviderName, false)] + public void ParseKormConnectionStringKeys(string connectionString, string provider, bool autoMigrate) + { + var services = new ServiceCollection(); + + KormBuilder builder = services.AddKorm(connectionString); + + builder.KormProvider.Should().Be(provider); + builder.AutoMigrate.Should().Be(autoMigrate); + builder.ConnectionString.Should().Be("server=localhost"); } } } diff --git a/tests/appsettings.autoupdateoff.json b/tests/appsettings.autoupdateoff.json deleted file mode 100644 index 00b3075..0000000 --- a/tests/appsettings.autoupdateoff.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "Debug": { - "LogLevel": { - "Default": "Warning" - } - }, - "Console": { - "LogLevel": { - "Default": "Warning" - } - } - }, - "ConnectionString": { - "Name": "Default", - "ProviderName": "System.Data.SqlClient", - "ConnectionString": "Server=servername\\instancename;Initial Catalog=database;Persist Security Info=False;" - }, - "KormMigrations": { - "ConnectionString": { - "ProviderName": "System.Data.SqlClient", - "ConnectionString": "Server=servername\\instancename;Initial Catalog=database;Persist Security Info=False;" - }, - "AutoMigrate": "False" - } -} diff --git a/tests/appsettings.json b/tests/appsettings.json new file mode 100644 index 0000000..3bcf71e --- /dev/null +++ b/tests/appsettings.json @@ -0,0 +1,19 @@ +{ + "Logging": { + "IncludeScopes": false, + "Debug": { + "LogLevel": { + "Default": "Warning" + } + }, + "Console": { + "LogLevel": { + "Default": "Warning" + } + } + }, + "ConnectionStrings": { + "DefaultConnection": "server=servername\\instancename;initial catalog=database", + "IdGenerator": "Server=STANO-NTB\\SQLEXPRESS; Integrated Security=true; Persist Security Info=true" + } +} diff --git a/tests/appsettings.missingsection.json b/tests/appsettings.missingsection.json deleted file mode 100644 index c851e12..0000000 --- a/tests/appsettings.missingsection.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "Debug": { - "LogLevel": { - "Default": "Warning" - } - }, - "Console": { - "LogLevel": { - "Default": "Warning" - } - } - } -} diff --git a/tests/appsettings.standard.json b/tests/appsettings.standard.json deleted file mode 100644 index 5ecdbcd..0000000 --- a/tests/appsettings.standard.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "Logging": { - "IncludeScopes": false, - "Debug": { - "LogLevel": { - "Default": "Warning" - } - }, - "Console": { - "LogLevel": { - "Default": "Warning" - } - } - }, - "ConnectionString": { - "Name": "Default", - "ProviderName": "System.Data.SqlClient", - "ConnectionString": "Server=servername\\instancename;Initial Catalog=database;Persist Security Info=False;" - }, - "KormMigrations": { - "ConnectionString": { - "ProviderName": "System.Data.SqlClient", - "ConnectionString": "Server=servername\\instancename;Initial Catalog=database;Persist Security Info=False;" - }, - "AutoMigrate": "True" - } -} From fc47630a214c879e990bc87cce7e6003cd8a0cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stano=20Pe=C5=A5ko?= Date: Tue, 2 Jul 2019 21:41:30 +0200 Subject: [PATCH 05/15] Resources and check for connection string name. --- src/Properties/Resources.Designer.cs | 21 ++++++--------------- src/Properties/Resources.resx | 14 ++++++-------- src/ServiceCollectionExtensions.cs | 17 +++++++++++++---- tests/ServiceCollectionExtensionsShould.cs | 15 +++++++++++++++ 4 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/Properties/Resources.Designer.cs b/src/Properties/Resources.Designer.cs index 877f6d8..d8ab260 100644 --- a/src/Properties/Resources.Designer.cs +++ b/src/Properties/Resources.Designer.cs @@ -61,29 +61,20 @@ internal Resources() { } /// - /// Looks up a localized string similar to Configuration section '{0}' is missing.. + /// Looks up a localized string similar to Connection string contains only KORM keys. These are removed and so connection string is empty.. /// - internal static string ConfigurationSectionIsMissing { + internal static string ConnectionStringContainsOnlyKormKeys { get { - return ResourceManager.GetString("ConfigurationSectionIsMissing", resourceCulture); + return ResourceManager.GetString("ConnectionStringContainsOnlyKormKeys", resourceCulture); } } /// - /// Looks up a localized string similar to 'ConnectionString' is required.. + /// Looks up a localized string similar to Connection strings section does not contain a connection string with name '{0}'.. /// - internal static string ConnectionStringIsRequired { + internal static string InvalidConnectionStringName { get { - return ResourceManager.GetString("ConnectionStringIsRequired", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to 'ProviderName' is required.. - /// - internal static string ProviderNameIsRequired { - get { - return ResourceManager.GetString("ProviderNameIsRequired", resourceCulture); + return ResourceManager.GetString("InvalidConnectionStringName", resourceCulture); } } } diff --git a/src/Properties/Resources.resx b/src/Properties/Resources.resx index 6c93ecc..c8ba7b2 100644 --- a/src/Properties/Resources.resx +++ b/src/Properties/Resources.resx @@ -1,4 +1,4 @@ - +