diff --git a/LiteCharms.Features.MidrandBooks.Seed/Program.cs b/LiteCharms.Features.MidrandBooks.Seed/Program.cs index 10d3172..8483ab8 100644 --- a/LiteCharms.Features.MidrandBooks.Seed/Program.cs +++ b/LiteCharms.Features.MidrandBooks.Seed/Program.cs @@ -14,7 +14,7 @@ builder.Services.AddScopedFeatureManagement(); builder.Services .AddLogging() - .AddShopServices() + .AddShopServices() .AddHostedService() .AddHostedService() .AddHostedService() diff --git a/LiteCharms.Features.MidrandBooks.Tests/Common/Fixture.cs b/LiteCharms.Features.MidrandBooks.Tests/Common/Fixture.cs index 0732e5b..a5a759f 100644 --- a/LiteCharms.Features.MidrandBooks.Tests/Common/Fixture.cs +++ b/LiteCharms.Features.MidrandBooks.Tests/Common/Fixture.cs @@ -1,5 +1,7 @@ using LiteCharms.Features.Extensions; +using LiteCharms.Features.MidrandBooks.Abstractions; using LiteCharms.Features.MidrandBooks.Extensions; +using Microsoft.VisualStudio.TestPlatform.TestHost; namespace LiteCharms.Features.MidrandBooks.Tests.Common; diff --git a/LiteCharms.Features.MidrandBooks/Abstractions/IMidrandBooks.cs b/LiteCharms.Features.MidrandBooks/Abstractions/IMidrandBooks.cs new file mode 100644 index 0000000..3994e63 --- /dev/null +++ b/LiteCharms.Features.MidrandBooks/Abstractions/IMidrandBooks.cs @@ -0,0 +1,3 @@ +namespace LiteCharms.Features.MidrandBooks.Abstractions; + +public interface IMidrandBooks; diff --git a/LiteCharms.Features.MidrandBooks/Extensions/Shop.cs b/LiteCharms.Features.MidrandBooks/Extensions/Shop.cs index fddb438..254f236 100644 --- a/LiteCharms.Features.MidrandBooks/Extensions/Shop.cs +++ b/LiteCharms.Features.MidrandBooks/Extensions/Shop.cs @@ -1,4 +1,5 @@ using LiteCharms.Features.Abstractions; +using LiteCharms.Features.MidrandBooks.Abstractions; namespace LiteCharms.Features.MidrandBooks.Extensions; @@ -8,11 +9,15 @@ public static class Shop { var serviceType = typeof(IService); - var implementations = Assembly.GetExecutingAssembly().GetTypes() + var sharedImplementations = typeof(IFeatures).Assembly.GetTypes() .Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract); - foreach (var implementation in implementations) - services.AddScoped(implementation); + foreach (var sharedImplementation in sharedImplementations) services.AddScoped(sharedImplementation); + + var coreImplementations = typeof(IMidrandBooks).Assembly.GetTypes() + .Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract); + + foreach (var coreImplementation in coreImplementations) services.AddScoped(coreImplementation); return services; } diff --git a/LiteCharms.Features/Abstractions/IFeatures.cs b/LiteCharms.Features/Abstractions/IFeatures.cs new file mode 100644 index 0000000..48a49c5 --- /dev/null +++ b/LiteCharms.Features/Abstractions/IFeatures.cs @@ -0,0 +1,3 @@ +namespace LiteCharms.Features.Abstractions; + +public interface IFeatures;