DLL files post-build copying to proper directory.
This commit is contained in:
parent
526a5aa80a
commit
4c5fce0332
58
DressAtelierContracts/DI/DependencyContainerUnity.cs
Normal file
58
DressAtelierContracts/DI/DependencyContainerUnity.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
using Unity.Microsoft.Logging;
|
||||
|
||||
namespace DressAtelierContracts.DI
|
||||
{
|
||||
public class DependencyContainerUnity : IDependencyContainer
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public DependencyContainerUnity()
|
||||
{
|
||||
_container = new UnityContainer();
|
||||
}
|
||||
|
||||
public void AddLogging(Action<ILoggingBuilder> configure)
|
||||
{
|
||||
ILoggerFactory loggerFactory = LoggerFactory.Create(configure);
|
||||
_container.AddExtension(new LoggingExtension(loggerFactory));
|
||||
}
|
||||
|
||||
public void RegisterType<T>(bool isSingle) where T : class
|
||||
{
|
||||
if (isSingle)
|
||||
{
|
||||
_container.RegisterType<T>(TypeLifetime.Singleton);
|
||||
}
|
||||
else
|
||||
{
|
||||
_container.RegisterType<T>();
|
||||
}
|
||||
}
|
||||
|
||||
public T Resolve<T>()
|
||||
{
|
||||
return _container.Resolve<T>();
|
||||
}
|
||||
|
||||
void IDependencyContainer.RegisterType<T, U>(bool isSingle)
|
||||
{
|
||||
if (isSingle)
|
||||
{
|
||||
_container.RegisterType<T,U>(TypeLifetime.Singleton);
|
||||
}
|
||||
else
|
||||
{
|
||||
_container.RegisterType<T,U>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DressAtelierContracts.DI
|
||||
{
|
||||
public class ServiceProviderLoader
|
||||
public static partial class ServiceProviderLoader
|
||||
{
|
||||
public static IImplementationExtension? GetImplementationExtensions()
|
||||
{
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -20,4 +20,8 @@
|
||||
<ProjectReference Include="..\DressAtelierDataModels\DressAtelierDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -11,4 +11,8 @@
|
||||
<ProjectReference Include="..\DressAtelierDataModels\DressAtelierDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -11,4 +11,8 @@
|
||||
<ProjectReference Include="..\DressAtelierDataModels\DressAtelierDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -1,6 +1,5 @@
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using DressAtelierContracts.DI;
|
||||
using Microsoft.EntityFrameworkCore.Diagnostics;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -5,7 +5,6 @@ using DressAtelierBusinessLogic.OfficePackage.Implements;
|
||||
using DressAtelierContracts.BindingModels;
|
||||
using DressAtelierContracts.BusinessLogicContracts;
|
||||
using DressAtelierContracts.DI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog.Extensions.Logging;
|
||||
|
||||
@ -23,7 +22,6 @@ namespace SewingDresses
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
var services = new ServiceCollection();
|
||||
InitDependencies();
|
||||
|
||||
try
|
||||
@ -60,14 +58,6 @@ namespace SewingDresses
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
|
||||
DependencyManager.Instance.RegisterType<IMaterialStorage, MaterialStorage>();
|
||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||
DependencyManager.Instance.RegisterType<IDressStorage, DressStorage>();
|
||||
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
||||
DependencyManager.Instance.RegisterType<IEmployeeStorage, EmployeeStorage>();
|
||||
DependencyManager.Instance.RegisterType<IMessageInfoStorage,MessageInfoStorage>();
|
||||
DependencyManager.Instance.RegisterType<IBackupInfo, BackupInfo>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IMaterialLogic, MaterialLogic>();
|
||||
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
||||
DependencyManager.Instance.RegisterType<IDressLogic, DressLogic>();
|
||||
@ -78,7 +68,7 @@ namespace SewingDresses
|
||||
DependencyManager.Instance.RegisterType<IBackupLogic, BackupLogic>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IWorkImitation, WorkImitation>();
|
||||
DependencyManager.Instance.RegisterType<AbstractMailEmployee, MailKitEmployee>();
|
||||
DependencyManager.Instance.RegisterType<AbstractMailEmployee, MailKitEmployee>(true);
|
||||
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
||||
|
@ -37,10 +37,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DressAtelierBusinessLogic\DressAtelierBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\DressAtelierContracts\DressAtelierContracts.csproj" />
|
||||
<ProjectReference Include="..\DressAtelierDatabaseImplement\DressAtelierDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\DressAtelierDataModels\DressAtelierDataModels.csproj" />
|
||||
<ProjectReference Include="..\DressAtelierFileImplement\DressAtelierFileImplement.csproj" />
|
||||
<ProjectReference Include="..\DressAtelierListImplement\DressAtelierListImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user