mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
package updates
This commit is contained in:
parent
955fa7e262
commit
2171768757
23 changed files with 60 additions and 67 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue