#Работает
This commit is contained in:
parent
63874944b2
commit
86a61a24be
BIN
JewelryStore/ImplementationExtensions/JewelryStoreContracts.dll
Normal file
BIN
JewelryStore/ImplementationExtensions/JewelryStoreContracts.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
JewelryStore/ImplementationExtensions/JewerlyStoreDataModels.dll
Normal file
BIN
JewelryStore/ImplementationExtensions/JewerlyStoreDataModels.dll
Normal file
Binary file not shown.
Binary file not shown.
@ -0,0 +1,55 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Unity;
|
||||||
|
using Unity.Microsoft.Logging;
|
||||||
|
|
||||||
|
namespace JewelryStoreContracts.DI
|
||||||
|
{
|
||||||
|
public class UnityDependencyContainer : IDependencyContainer
|
||||||
|
{
|
||||||
|
private readonly UnityContainer _container;
|
||||||
|
|
||||||
|
public UnityDependencyContainer()
|
||||||
|
{
|
||||||
|
_container = new UnityContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddLogging(Action<ILoggingBuilder> configure)
|
||||||
|
{
|
||||||
|
_container.AddExtension(new LoggingExtension(LoggerFactory.Create(configure)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterType<T, U>(bool isSingle) where U : class, T where T : class
|
||||||
|
{
|
||||||
|
if (isSingle)
|
||||||
|
{
|
||||||
|
_container.RegisterSingleton<T, U>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_container.RegisterType<T, U>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterType<T>(bool isSingle) where T : class
|
||||||
|
{
|
||||||
|
if (isSingle)
|
||||||
|
{
|
||||||
|
_container.RegisterSingleton<T>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_container.RegisterType<T>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public T Resolve<T>()
|
||||||
|
{
|
||||||
|
return _container.Resolve<T>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,6 +12,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<BaseOutputPath>D:\SecondSemRPP\JewelryStore\ImplementationExtensions</BaseOutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.27" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.27" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.27">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.7" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\JewelryStoreContracts\JewelryStoreContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\JewerlyStoreDataModels\JewerlyStoreDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Migrations\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions*.dll"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
</Project>
|
@ -4,6 +4,7 @@
|
|||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<BaseOutputPath></BaseOutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -25,4 +26,8 @@
|
|||||||
<Folder Include="Migrations\" />
|
<Folder Include="Migrations\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "D:\SecondSemRPP\JewelryStore\ImplementationExtensions"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -18,4 +18,8 @@
|
|||||||
<ProjectReference Include="..\JewerlyStoreDataModels\JewerlyStoreDataModels.csproj" />
|
<ProjectReference Include="..\JewerlyStoreDataModels\JewerlyStoreDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "D:\SecondSemRPP\JewelryStore\ImplementationExtensions"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -18,4 +18,8 @@
|
|||||||
<ProjectReference Include="..\JewerlyStoreDataModels\JewerlyStoreDataModels.csproj" />
|
<ProjectReference Include="..\JewerlyStoreDataModels\JewerlyStoreDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "D:\SecondSemRPP\JewelryStore\ImplementationExtensions"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user