Add project files.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
namespace PoweredSoft.Module.Abstractions
|
||||
{
|
||||
public interface IModule
|
||||
{
|
||||
IServiceCollection ConfigureServices(IServiceCollection services);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,14 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace PoweredSoft.Module.Abstractions
|
||||
{
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddModule<T>(IServiceCollection services)
|
||||
where T : IModule, new()
|
||||
{
|
||||
var module = new T();
|
||||
return module.ConfigureServices(services);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user