package updates

This commit is contained in:
tidusjar 2020-09-30 22:36:09 +01:00
parent 955fa7e262
commit 2171768757
23 changed files with 60 additions and 67 deletions

View file

@ -2,8 +2,10 @@
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using AutoMapper;
using AutoMapper.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Ombi.Mapping.Profiles;
namespace Ombi.Mapping
{
@ -11,18 +13,17 @@ namespace Ombi.Mapping
{
public static IServiceCollection AddOmbiMappingProfile(this IServiceCollection services)
{
Assembly ass = typeof(AutoMapperProfile).GetTypeInfo().Assembly;
var assemblies = new List<Type>();
foreach (TypeInfo ti in ass.DefinedTypes)
var profiles = new List<Profile>
{
if (ti.ImplementedInterfaces.Contains(typeof(IProfileConfiguration)))
{
assemblies.Add(ti.AsType());
}
}
new MovieProfile(),
new OmbiProfile(),
new SettingsProfile(),
new TvProfile(),
new TvProfileV2()
};
var config = new AutoMapper.MapperConfiguration(cfg =>
{
cfg.AddProfiles(assemblies);
cfg.AddProfiles(profiles);
});
var mapper = config.CreateMapper();