SES-66 Services #14

Merged
s426134 merged 4 commits from SES-66 into master 2020-12-06 08:58:32 +01:00
18 changed files with 312 additions and 0 deletions
Showing only changes of commit 2db796f3dc - Show all commits

View File

@ -0,0 +1,18 @@
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.AlignmentViewModels;
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Text;
using SessionCompanion.Database.Repositories.Base;
namespace SessionCompanion.Services.Services
{
public class AlignmentService : ServiceBase<AlignmentViewModel, Alignment>, IAlignmentService
{
public AlignmentService(IMapper mapper, IRepository<Alignment> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.BackgroundViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Services
{
public class BackgroundServices : ServiceBase<BackgroundViewModel, Background>, IBackgroundService
{
public BackgroundServices(IMapper mapper, IRepository<Background> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,20 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.BiographyViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace SessionCompanion.Services.Services
{
public class BiographyService : ServiceBase<BiographyViewModel, Biography>, IBiographyService
{
public BiographyService(IMapper mapper, IRepository<Biography> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,25 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.CharacterViewModels;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore;
using AutoMapper.QueryableExtensions;
using System.IO;
using Newtonsoft.Json.Linq;
namespace SessionCompanion.Services.Services
{
public class CharacterService : ServiceBase<CharacterViewModel, Character>, ICharacterService
{
public CharacterService(IMapper mapper, IRepository<Character> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.CharismaViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Services
{
public class CharismaService : ServiceBase<CharismaViewModel, Charisma>, ICharismaService
{
public CharismaService(IMapper mapper, IRepository<Charisma> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,20 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.ClassViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Services.Services
{
public class ClassService : ServiceBase<ClassViewModel, Class>, IClassService
{
public ClassService(IMapper mapper, IRepository<Class> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.ConstitutionViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Services
{
public class ConstitutionService : ServiceBase<ConstitutionViewModel, Constitution>, IConstitutionService
{
public ConstitutionService(IMapper mapper, IRepository<Constitution> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.DexterityViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Services
{
public class DexterityService : ServiceBase<DexterityViewModel, Dexterity>, IDexterityService
{
public DexterityService(IMapper mapper, IRepository<Dexterity> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.IntelligenceViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Services
{
public class IntelligenceService : ServiceBase<IntelligenceViewModel, Intelligence>, IIntelligenceService
{
public IntelligenceService(IMapper mapper, IRepository<Intelligence> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.RaceViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Services
{
public class RaceService : ServiceBase<RaceViewModel, Race>, IRaceService
{
public RaceService(IMapper mapper, IRepository<Race> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,21 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.StatisticsViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SessionCompanion.Services.Services
{
public class StatisticsService : ServiceBase<StatisticsViewModel, Statistics>, IStatisticsService
{
public StatisticsService(IMapper mapper, IRepository<Statistics> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.StrengthViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Services
{
public class StrengthService : ServiceBase<StrengthViewModel, Strength>, IStrengthService
{
public StrengthService(IMapper mapper, IRepository<Strength> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,21 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.UserViewModels;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace SessionCompanion.Services.Services
{
public class UserService : ServiceBase<UserViewModel, User>, IUserService
{
public UserService(IMapper mapper, IRepository<User> repository) : base(mapper, repository)
{ }
}
}

View File

@ -0,0 +1,18 @@
using AutoMapper;
using SessionCompanion.Database.Repositories.Base;
using SessionCompanion.Database.Tables;
using SessionCompanion.Services.Base;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.ViewModels.WisdomViewModels;
using System;
using System.Collections.Generic;
using System.Text;
namespace SessionCompanion.Services.Services
{
public class WisdomService : ServiceBase<WisdomViewModel, Wisdom>, IWisdomService
{
public WisdomService(IMapper mapper, IRepository<Wisdom> repository) : base(mapper, repository)
{ }
}
}

View File

@ -4,4 +4,13 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SessionCompanion.Database\SessionCompanion.Database.csproj" />
<ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" />
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,32 @@
using Microsoft.Extensions.DependencyInjection;
using SessionCompanion.Services.Interfaces;
using SessionCompanion.Services.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace SessionCompanion.Configurations
{
public static class ServiceConfiguration
{
public static IServiceCollection AddServices(this IServiceCollection services)
{
services.AddScoped<IAlignmentService, AlignmentService>();
services.AddScoped<IBackgroundService, BackgroundServices>();
services.AddScoped<IBiographyService, BiographyService>();
services.AddScoped<ICharacterService, CharacterService>();
services.AddScoped<ICharismaService, CharismaService>();
services.AddScoped<IClassService, ClassService>();
services.AddScoped<IConstitutionService, ConstitutionService>();
services.AddScoped<IDexterityService, DexterityService>();
services.AddScoped<IIntelligenceService, IntelligenceService>();
services.AddScoped<IRaceService, RaceService>();
services.AddScoped<IStatisticsService, StatisticsService>();
services.AddScoped<IStrengthService, StrengthService>();
services.AddScoped<IUserService, UserService>();
services.AddScoped<IWisdomService, WisdomService>();
return services;
}
}
}

View File

@ -34,6 +34,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SessionCompanion.Database\SessionCompanion.Database.csproj" /> <ProjectReference Include="..\SessionCompanion.Database\SessionCompanion.Database.csproj" />
<ProjectReference Include="..\SessionCompanion.Services\SessionCompanion.Services.csproj" />
<ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" /> <ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -31,6 +31,7 @@ namespace SessionCompanion
options.UseSqlServer( options.UseSqlServer(
Configuration.GetConnectionString("DefaultConnection"))); Configuration.GetConnectionString("DefaultConnection")));
services.AddRepositories(); services.AddRepositories();
services.AddServices();
services.AddSignalR(); services.AddSignalR();
// In production, the Angular files will be served from this directory // In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration => services.AddSpaStaticFiles(configuration =>