using Abp.AspNetCore;
using Abp.AspNetCore.Configuration;
using Abp.AutoMapper;
using Abp.Modules;
using Abp.Reflection.Extensions;
using YGNT.File.Core;

namespace YGNT.File.Application
{
    /// <summary>
    /// 门户网站模块
    /// </summary>

    [DependsOn(
        typeof(FileCoreModule),
        typeof(AbpAspNetCoreModule),
        typeof(AbpAutoMapperModule))]
    public class FileApplicationModule : AbpModule
    {

        public override void PreInitialize()
        {
            Configuration.Modules.AbpAspNetCore()
                .CreateControllersForAppServices(
                    typeof(FileApplicationModule).GetAssembly(),
                    "File"
                );
        }

        public override void Initialize()
        {
            var thisAssembly = typeof(FileApplicationModule).GetAssembly();

            IocManager.RegisterAssemblyByConvention(thisAssembly);

            Configuration.Modules.AbpAutoMapper().Configurators.Add(
                // Scan the assembly for classes which inherit from AutoMapper.Profile
                cfg => cfg.AddMaps(thisAssembly)
            );
        }
    }
}
