Ombi/src/Ombi.Mapping/AutoMapperProfile.cs
2020-09-30 22:36:09 +01:00

35 lines
No EOL
933 B
C#

using System;
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
{
public static class AutoMapperProfile
{
public static IServiceCollection AddOmbiMappingProfile(this IServiceCollection services)
{
var profiles = new List<Profile>
{
new MovieProfile(),
new OmbiProfile(),
new SettingsProfile(),
new TvProfile(),
new TvProfileV2()
};
var config = new AutoMapper.MapperConfiguration(cfg =>
{
cfg.AddProfiles(profiles);
});
var mapper = config.CreateMapper();
services.AddSingleton(mapper);
return services;
}
}
}