Skip to content

Commit

Permalink
Remove Policy
Browse files Browse the repository at this point in the history
  • Loading branch information
ricksu978 committed Mar 16, 2024
1 parent b51b469 commit cd20673
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/BackEnd/src/Core/Application/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ public static IServiceCollection AddWerewolfApplication(this IServiceCollection
// Inject Use Cases
services.AddUseCases();

// Inject Policies
services.AddPolicies();

// GameEvenPublisher
services.AddScoped<GameEventBus>();

Expand All @@ -33,21 +30,4 @@ private static IServiceCollection AddUseCases(this IServiceCollection services)

return services;
}

private static IServiceCollection AddPolicies(this IServiceCollection services)
{
var assembly = typeof(DependencyInjection).Assembly;
var types = assembly.GetTypes();
var policyType = typeof(Policy<>);

foreach (var type in types)
{
if (type.BaseType?.IsGenericType == true && type.BaseType?.GetGenericTypeDefinition() == policyType)
{
services.AddScoped(type.BaseType, type);
}
}

return services;
}
}

0 comments on commit cd20673

Please sign in to comment.