diff options
author | Serghei Cebotari <serghei@cebotari.ru> | 2024-02-09 16:48:42 +0300 |
---|---|---|
committer | Serghei Cebotari <serghei@cebotari.ru> | 2024-02-09 16:48:42 +0300 |
commit | c13f4ddda1ec917c8957db2bcc397c5bc80c39fe (patch) | |
tree | d1d6ce155f277bd817a182015a1f21f6437195eb | |
parent | 27167ace1bcc3e17460409b54c3b1bbbb0e76c71 (diff) |
Rename service add method
-rw-r--r-- | RhSolutions.Api/Program.cs | 2 | ||||
-rw-r--r-- | RhSolutions.Parsers.Tests/TestServiceCollection.cs | 2 | ||||
-rw-r--r-- | RhSolutions.Parsers/ParsersRegistration.cs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/RhSolutions.Api/Program.cs b/RhSolutions.Api/Program.cs index 19268bc..62fb0e4 100644 --- a/RhSolutions.Api/Program.cs +++ b/RhSolutions.Api/Program.cs @@ -32,7 +32,7 @@ builder.Services.AddIdentity<IdentityUser, IdentityRole>() builder.Services.AddScoped<IPricelistParser, ClosedXMLParser>() .AddScoped<IProductTypePredicter, ProductTypePredicter>(); -builder.Services.AddModifiers(); +builder.Services.AddProductParsers(); builder.Services.AddControllers(); builder.Services.AddSwaggerGen(options => { diff --git a/RhSolutions.Parsers.Tests/TestServiceCollection.cs b/RhSolutions.Parsers.Tests/TestServiceCollection.cs index 9f15c89..3ea95e8 100644 --- a/RhSolutions.Parsers.Tests/TestServiceCollection.cs +++ b/RhSolutions.Parsers.Tests/TestServiceCollection.cs @@ -11,7 +11,7 @@ public class TestServiceCollection public void CreateProvider() { var collection = new ServiceCollection(); - collection.AddModifiers(); + collection.AddProductParsers(); ServiceProvider = collection.BuildServiceProvider(); } diff --git a/RhSolutions.Parsers/ParsersRegistration.cs b/RhSolutions.Parsers/ParsersRegistration.cs index 54f34be..b61e503 100644 --- a/RhSolutions.Parsers/ParsersRegistration.cs +++ b/RhSolutions.Parsers/ParsersRegistration.cs @@ -5,7 +5,7 @@ namespace RhSolutions.Parsers; public static class ParsersRegistration { - public static void AddModifiers(this IServiceCollection services) + public static void AddProductParsers(this IServiceCollection services) { var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s => s.GetTypes()) @@ -13,12 +13,12 @@ public static class ParsersRegistration foreach (Type t in types) { - string key = GetModifierKey(t); + string key = GetParserKey(t); services.AddKeyedTransient(typeof(IProductParser), key, t); } } - private static string GetModifierKey(Type t) + private static string GetParserKey(Type t) { return t.GetCustomAttribute<ParserKey>()?.Value ?? string.Empty; } |