using Abp.AutoMapper;
using Abp.Modules;
using Abp.Reflection.Extensions;
using YGNT.Exam.Authorization;
using YGNT.QuestionLibrary;

namespace YGNT.Exam
{
    [DependsOn(
        typeof(ExamCoreModule),
        typeof(AbpAutoMapperModule))]
    public class ExamApplicationModule : AbpModule
    {
        public override void PreInitialize()
        {
            Configuration.Authorization.Providers.Add<ExamAuthorizationProvider>();
        }

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

            IocManager.RegisterAssemblyByConvention(thisAssembly);

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