Skip to content

Commit

Permalink
Extract console project from samples
Browse files Browse the repository at this point in the history
  • Loading branch information
lucadecamillis committed Aug 27, 2023
1 parent 7777631 commit 9b07c6b
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 65 deletions.
32 changes: 22 additions & 10 deletions LdC.DependencyInjection.Configuration.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LdC.DependencyInjection.Configuration", "src\LdC.DependencyInjection.Configuration.csproj", "{95D3C23E-AA83-4AE4-BFCC-CE5168A4EE5D}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LdC.DependencyInjection.Configuration", "src\LdC.DependencyInjection.Configuration.csproj", "{B7729C4B-34DC-406C-90E3-BA7B7831CFF8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LdC.DependencyInjection.Configuration.Sample", "sample\LdC.DependencyInjection.Configuration.Sample.csproj", "{35C16395-57C7-42A7-A328-709B37E396A3}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{47E92DAE-CDC5-4CAB-AF72-1B665A7649DF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Lib", "samples\lib\Samples.Lib.csproj", "{9B15CDCC-73B3-4B1C-9883-A84B71E76E09}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.Console", "samples\console\Samples.Console.csproj", "{957CDE85-0519-4A71-AC1D-06D8C66B1F33}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -16,13 +20,21 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{95D3C23E-AA83-4AE4-BFCC-CE5168A4EE5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95D3C23E-AA83-4AE4-BFCC-CE5168A4EE5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95D3C23E-AA83-4AE4-BFCC-CE5168A4EE5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95D3C23E-AA83-4AE4-BFCC-CE5168A4EE5D}.Release|Any CPU.Build.0 = Release|Any CPU
{35C16395-57C7-42A7-A328-709B37E396A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35C16395-57C7-42A7-A328-709B37E396A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35C16395-57C7-42A7-A328-709B37E396A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35C16395-57C7-42A7-A328-709B37E396A3}.Release|Any CPU.Build.0 = Release|Any CPU
{B7729C4B-34DC-406C-90E3-BA7B7831CFF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7729C4B-34DC-406C-90E3-BA7B7831CFF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7729C4B-34DC-406C-90E3-BA7B7831CFF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7729C4B-34DC-406C-90E3-BA7B7831CFF8}.Release|Any CPU.Build.0 = Release|Any CPU
{9B15CDCC-73B3-4B1C-9883-A84B71E76E09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9B15CDCC-73B3-4B1C-9883-A84B71E76E09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9B15CDCC-73B3-4B1C-9883-A84B71E76E09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9B15CDCC-73B3-4B1C-9883-A84B71E76E09}.Release|Any CPU.Build.0 = Release|Any CPU
{957CDE85-0519-4A71-AC1D-06D8C66B1F33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{957CDE85-0519-4A71-AC1D-06D8C66B1F33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{957CDE85-0519-4A71-AC1D-06D8C66B1F33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{957CDE85-0519-4A71-AC1D-06D8C66B1F33}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9B15CDCC-73B3-4B1C-9883-A84B71E76E09} = {47E92DAE-CDC5-4CAB-AF72-1B665A7649DF}
{957CDE85-0519-4A71-AC1D-06D8C66B1F33} = {47E92DAE-CDC5-4CAB-AF72-1B665A7649DF}
EndGlobalSection
EndGlobal
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ Services definition is read from `appsettings.json`:
"Services": {
"Collection": [
{
"ServiceType": "Sample.Interfaces.IRepository, Sample",
"ImplementationType": "Sample.Impl.Repository, Sample",
"ServiceType": "Samples.Lib.Interfaces.IRepository, Samples.Lib",
"ImplementationType": "Samples.Lib.Impl.Repository, Samples.Lib",
"Lifetime": "Scoped"
},
{
"ServiceType": "Sample.Interfaces.IService, Sample",
"ImplementationType": "Sample.Impl.Service, Sample"
"ServiceType": "Samples.Lib.Interfaces.IService, Samples.Lib",
"ImplementationType": "Samples.Lib.Impl.Service, Samples.Lib"
},
{
"ServiceType": "Samples.Lib.Impl.Context, Samples.Lib",
"Lifetime": "Singleton"
}
]
}
Expand Down
6 changes: 0 additions & 6 deletions sample/Impl/Context.cs

This file was deleted.

8 changes: 0 additions & 8 deletions sample/Impl/Repository.cs

This file was deleted.

6 changes: 0 additions & 6 deletions sample/Interfaces/IRepository.cs

This file was deleted.

6 changes: 0 additions & 6 deletions sample/Interfaces/IService.cs

This file was deleted.

19 changes: 0 additions & 19 deletions sample/appsettings.json

This file was deleted.

4 changes: 2 additions & 2 deletions sample/Program.cs → samples/console/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Samples.Lib.Impl;
using Samples.Lib.Interfaces;
using LdC.DependencyInjection.Configuration;
using LdC.DependencyInjection.Configuration.Sample.Interfaces;
using LdC.DependencyInjection.Configuration.Sample.Impl;

var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -10,6 +10,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\src\LdC.DependencyInjection.Configuration.csproj" />
<ProjectReference Include="..\..\src\LdC.DependencyInjection.Configuration.csproj" />
<ProjectReference Include="..\lib\Samples.Lib.csproj" />
</ItemGroup>
</Project>
19 changes: 19 additions & 0 deletions samples/console/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"Services": {
"Collection": [
{
"ServiceType": "Samples.Lib.Interfaces.IRepository, Samples.Lib",
"ImplementationType": "Samples.Lib.Impl.Repository, Samples.Lib",
"Lifetime": "Scoped"
},
{
"ServiceType": "Samples.Lib.Interfaces.IService, Samples.Lib",
"ImplementationType": "Samples.Lib.Impl.Service, Samples.Lib"
},
{
"ServiceType": "Samples.Lib.Impl.Context, Samples.Lib",
"Lifetime": "Singleton"
}
]
}
}
6 changes: 6 additions & 0 deletions samples/lib/Impl/Context.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Samples.Lib.Impl;

public class Context
{

}
8 changes: 8 additions & 0 deletions samples/lib/Impl/Repository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Samples.Lib.Interfaces;

namespace Samples.Lib.Impl;

public class Repository : IRepository
{

}
4 changes: 2 additions & 2 deletions sample/Impl/Service.cs → samples/lib/Impl/Service.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using LdC.DependencyInjection.Configuration.Sample.Interfaces;
using Samples.Lib.Interfaces;

namespace LdC.DependencyInjection.Configuration.Sample.Impl;
namespace Samples.Lib.Impl;

public class Service : IService
{
Expand Down
6 changes: 6 additions & 0 deletions samples/lib/Interfaces/IRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Samples.Lib.Interfaces;

public interface IRepository
{

}
6 changes: 6 additions & 0 deletions samples/lib/Interfaces/IService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Samples.Lib.Interfaces;

public interface IService
{

}
9 changes: 9 additions & 0 deletions samples/lib/Samples.Lib.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>

0 comments on commit 9b07c6b

Please sign in to comment.