Skip to content

Commit dd2781d

Browse files
Merge pull request #141 from AntonioFalcao/feature/database-resilience
Feature/database resilience
2 parents 61ef1b6 + 727b3f5 commit dd2781d

3 files changed

Lines changed: 20 additions & 24 deletions

File tree

src/Dotnet5.GraphQL3.Domain.Abstractions/Extensions/DependencyInjection/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static IServiceCollection AddBuilders(this IServiceCollection services)
1313
.FromApplicationDependencies(assembly
1414
=> assembly.FullName?.StartsWith(assembly.GetEntryAssemblySuffix()) ?? default)
1515
.AddClasses(filter
16-
=> filter.AssignableToAny(typeof(IBuilder<,>)))
16+
=> filter.AssignableTo(typeof(IBuilder<,>)))
1717
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
1818
.AsImplementedInterfaces()
1919
.WithScopedLifetime());

src/Dotnet5.GraphQL3.Repositories.Abstractions/Extensions/DependencyInjection/ServiceCollectionExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static IServiceCollection AddRepositories(this IServiceCollection service
1313
.FromApplicationDependencies(assembly
1414
=> assembly.FullName?.StartsWith(assembly.GetEntryAssemblySuffix()) ?? default)
1515
.AddClasses(filter
16-
=> filter.AssignableToAny(typeof(IRepository<,>)))
16+
=> filter.AssignableTo(typeof(IRepository<,>)))
1717
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
1818
.AsImplementedInterfaces()
1919
.WithScopedLifetime());

src/Dotnet5.GraphQL3.Services.Abstractions/Extensions/DependencyInjection/ServiceCollectionExtensions.cs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,31 @@ namespace Dotnet5.GraphQL3.Services.Abstractions.Extensions.DependencyInjection
1212
public static class ServiceCollectionExtensions
1313
{
1414
public static IServiceCollection AddApplicationServices(this IServiceCollection services)
15-
=> services.Scan(selector
16-
=> selector
17-
.FromApplicationDependencies(assembly
18-
=> assembly.FullName?.StartsWith(GetAssemblySuffix()) ?? default)
19-
.AddClasses(filter
20-
=> filter.AssignableToAny(typeof(IService<,,>)))
21-
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
22-
.AsImplementedInterfaces()
23-
.WithScopedLifetime());
15+
=> services.Scan(selector
16+
=> selector.FromApplicationDependencies(assembly
17+
=> assembly.FullName?.StartsWith(GetAssemblySuffix()) ?? default)
18+
.AddClasses(filter
19+
=> filter.AssignableTo(typeof(IService<,,>)))
20+
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
21+
.AsImplementedInterfaces()
22+
.WithScopedLifetime());
2423

2524
public static IServiceCollection AddMessageServices(this IServiceCollection services)
26-
=> services.Scan(selector
27-
=> selector
28-
.FromApplicationDependencies(assembly
29-
=> assembly.FullName?.StartsWith(GetAssemblySuffix()) ?? default)
30-
.AddClasses(filter
31-
=> filter.AssignableToAny(typeof(IMessageService<,,>)))
32-
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
33-
.AsImplementedInterfaces()
34-
.WithSingletonLifetime());
25+
=> services.Scan(selector
26+
=> selector.FromApplicationDependencies(assembly
27+
=> assembly.FullName?.StartsWith(GetAssemblySuffix()) ?? default)
28+
.AddClasses(filter
29+
=> filter.AssignableTo(typeof(IMessageService<,,>)))
30+
.UsingRegistrationStrategy(RegistrationStrategy.Skip)
31+
.AsImplementedInterfaces()
32+
.WithSingletonLifetime());
3533

3634
public static IServiceCollection AddSubjects(this IServiceCollection services)
3735
=> services.AddSingleton(typeof(ISubject<>), typeof(ReplaySubject<>));
3836

3937
public static IServiceCollection AddAutoMapper(this IServiceCollection services)
40-
=> services.AddAutoMapper(
41-
AppDomain.CurrentDomain.GetAssemblies()
42-
.Where(x => x.FullName?
43-
.Contains(GetAssemblySuffix()) ?? false));
38+
=> services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies().Where(x
39+
=> x.FullName?.Contains(GetAssemblySuffix()) ?? default));
4440

4541
private static string GetAssemblySuffix()
4642
=> Assembly.GetEntryAssembly()?.FullName?.Substring(0, 16);

0 commit comments

Comments
 (0)