Add draft impl for Business stack and IoC

This commit is contained in:
Sébastien André
2019-09-20 19:46:20 +02:00
parent 5d476e5e4e
commit cb105c13af
11 changed files with 116 additions and 12 deletions

View File

@@ -0,0 +1,12 @@
using skydiveLogs_api.Business.Interface;
using System;
using System.Collections.Generic;
using System.Text;
namespace skydiveLogs_api.Business
{
public class AircraftService : IAircraftService
{
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using skydiveLogs_api.Business.Interface;
namespace skydiveLogs_api.Business
{
public class DropZoneService : IDropZoneService
{
}
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Text;
using skydiveLogs_api.Business.Interface;
namespace skydiveLogs_api.Business
{
public class JumpService : IJumpService
{
}
}

View File

@@ -0,0 +1,11 @@
using skydiveLogs_api.Business.Interface;
using System;
using System.Collections.Generic;
using System.Text;
namespace skydiveLogs_api.Business
{
public class JumpTypeService : IJumpTypeService
{
}
}

View File

@@ -4,7 +4,7 @@ using System.Text;
namespace skydiveLogs_api.Data.Interface
{
interface IAircraftRepository
public interface IAircraftRepository
{
}
}

View File

@@ -0,0 +1,33 @@
using Microsoft.Extensions.DependencyInjection;
namespace skydiveLogs_api.Ioc
{
public class IocService
{
public IocService(IServiceCollection services)
{
_services = services;
}
public void Configure()
{
//services.AddSingleton<IConfigurationRoot>(Configuration);
//_services.AddSingleton<Services.IGroupService, Services.GroupService>();
//_services.AddSingleton<Services.IUserService, Services.UserService>();
//_services.AddSingleton<Services.IPermissionService, Services.PermissionService>();
_services.AddScoped<Business.Interface.IAircraftService, Business.AircraftService>();
_services.AddScoped<Business.Interface.IDropZoneService, Business.DropZoneService>();
_services.AddScoped<Business.Interface.IJumpService, Business.JumpService>();
_services.AddScoped<Business.Interface.IJumpTypeService, Business.JumpTypeService>();
_services.AddScoped<Data.Interface.IAircraftRepository, Data.AircraftRepository>();
_services.AddScoped<Data.Interface.IDropZoneRepository, Data.DropZoneRepository>();
_services.AddScoped<Data.Interface.IJumpRepository, Data.JumpRepository>();
_services.AddScoped<Data.Interface.IJumpTypeRepository, Data.JumpTypeRepository>();
_services.AddScoped<Data.Interface.IGearRepository, Data.GearRepository>();
}
private readonly IServiceCollection _services;
}
}

View File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>skydiveLogs_api.Ioc</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\skydiveLogs-api.Business\skydiveLogs-api.Business.csproj" />
<ProjectReference Include="..\skydiveLogs-api.Data\skydiveLogs-api.Data.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions">
<HintPath>..\..\..\..\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection.abstractions\2.2.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -5,11 +5,13 @@ VisualStudioVersion = 15.0.28307.852
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "skydiveLogs-api", "skydiveLogs-api\skydiveLogs-api.csproj", "{0AC70CC2-CE52-4CD9-89D6-077800574360}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skydiveLogs-api.Model", "skydiveLogs-api.Model\skydiveLogs-api.Model.csproj", "{EF101C84-AE0D-4F5E-8BC5-0C55CB0B5D23}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "skydiveLogs-api.Model", "skydiveLogs-api.Model\skydiveLogs-api.Model.csproj", "{EF101C84-AE0D-4F5E-8BC5-0C55CB0B5D23}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skydiveLogs-api.Business", "skydiveLogs-api.Business\skydiveLogs-api.Business.csproj", "{803C3CFD-71D7-452F-848D-BF3DAF876CDF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "skydiveLogs-api.Business", "skydiveLogs-api.Business\skydiveLogs-api.Business.csproj", "{803C3CFD-71D7-452F-848D-BF3DAF876CDF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skydiveLogs-api.Data", "skydiveLogs-api.Data\skydiveLogs-api.Data.csproj", "{887D2F69-A9E9-46C4-A5D9-3813A2387AA2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "skydiveLogs-api.Data", "skydiveLogs-api.Data\skydiveLogs-api.Data.csproj", "{887D2F69-A9E9-46C4-A5D9-3813A2387AA2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "skydiveLogs-api.Ioc", "skydiveLogs-api.Ioc\skydiveLogs-api.Ioc.csproj", "{D2ECA52D-DA50-47D4-8624-4487DE29E0C0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -33,6 +35,10 @@ Global
{887D2F69-A9E9-46C4-A5D9-3813A2387AA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{887D2F69-A9E9-46C4-A5D9-3813A2387AA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{887D2F69-A9E9-46C4-A5D9-3813A2387AA2}.Release|Any CPU.Build.0 = Release|Any CPU
{D2ECA52D-DA50-47D4-8624-4487DE29E0C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2ECA52D-DA50-47D4-8624-4487DE29E0C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2ECA52D-DA50-47D4-8624-4487DE29E0C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2ECA52D-DA50-47D4-8624-4487DE29E0C0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using skydiveLogs_api.Ioc;
namespace skydiveLogs_api
{
@@ -21,14 +22,8 @@ namespace skydiveLogs_api
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
// IoC
//services.AddSingleton<IConfigurationRoot>(Configuration);
//services.AddSingleton<Services.IGroupService, Services.GroupService>();
//services.AddSingleton<Services.IUserService, Services.UserService>();
//services.AddSingleton<Services.IPermissionService, Services.PermissionService>();
//services.AddScoped<Builder.IBuilderVmGroup, Builder.BuilderVmGroup>();
//services.AddScoped<Builder.IBuilderVmUser, Builder.BuilderVmUser>();
//services.AddScoped<Builder.IBuilderVmPermission, Builder.BuilderVmPermission>();
var iocService = new IocService(services);
iocService.Configure();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.

View File

@@ -14,6 +14,7 @@
<ItemGroup>
<ProjectReference Include="..\skydiveLogs-api.Business\skydiveLogs-api.Business.csproj" />
<ProjectReference Include="..\skydiveLogs-api.Ioc\skydiveLogs-api.Ioc.csproj" />
<ProjectReference Include="..\skydiveLogs-api.Model\skydiveLogs-api.Model.csproj" />
</ItemGroup>