adds first version of microsoft di support for piwigodotnet
piwigodotnet/pipeline/head This commit looks good Details

This commit is contained in:
Philipp Häfelfinger 2023-07-11 18:37:36 +02:00
parent 872c870cce
commit 80b293eec1
5 changed files with 48 additions and 4 deletions

View File

@ -16,7 +16,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="6.4.0" />
<PackageReference Include="Autofac" Version="7.0.1" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Piwigo.Client\Piwigo.Client.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,21 @@
using Microsoft.Extensions.DependencyInjection;
using Piwigo.Client.Albums;
using Piwigo.Client.Images;
using Piwigo.Client.Session;
using Piwigo.Client.Tags;
namespace Piwigo.Client.DependencyInjection;
public static class ServiceCollectionExtension
{
public static void AddPiwigoClient(this ServiceCollection services, IPiwigoConfiguration configuration)
{
services.AddSingleton(configuration);
services.AddScoped<IPiwigoContext, PiwigoContext>();
services.AddTransient<IAlbumApi, AlbumApi>();
services.AddTransient<IImageApi, ImageApi>();
services.AddTransient<ISessionApi, SessionApi>();
services.AddTransient<ITagApi, TagApi>();
services.AddTransient<IPiwigoClient, PiwigoClient>();
}
}

View File

@ -9,15 +9,15 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="FluentAssertions" Version="6.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piwigo.Client.Cli", "Piwigo
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piwigo.Client.Autofac", "Piwigo.Client.Autofac\Piwigo.Client.Autofac.csproj", "{C8247110-D9BB-4658-B36B-7AEB7A42C8EC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Piwigo.Client.DependencyInjection", "Piwigo.Client.DependencyInjection\Piwigo.Client.DependencyInjection.csproj", "{76166A7A-92DD-4A7F-B3BA-C5176213EC84}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -30,5 +32,9 @@ Global
{C8247110-D9BB-4658-B36B-7AEB7A42C8EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8247110-D9BB-4658-B36B-7AEB7A42C8EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8247110-D9BB-4658-B36B-7AEB7A42C8EC}.Release|Any CPU.Build.0 = Release|Any CPU
{76166A7A-92DD-4A7F-B3BA-C5176213EC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76166A7A-92DD-4A7F-B3BA-C5176213EC84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76166A7A-92DD-4A7F-B3BA-C5176213EC84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76166A7A-92DD-4A7F-B3BA-C5176213EC84}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal