pdf ใบสมัครสอบ

This commit is contained in:
Kittapath 2023-10-08 13:54:20 +07:00
parent 86a9e90b7a
commit 98b6cc0275
15 changed files with 710 additions and 68 deletions

View file

@ -7,30 +7,44 @@ using Microsoft.Extensions.DependencyInjection;
namespace BMA.EHR.Infrastructure
{
public static class InfrastructureServiceRegistration
{
public static IServiceCollection AddPersistence(this IServiceCollection services,
IConfiguration configuration)
public static class InfrastructureServiceRegistration
{
public static IServiceCollection AddPersistence(this IServiceCollection services,
IConfiguration configuration)
{
services.AddTransient<MinIOService>();
var connectionString = configuration.GetConnectionString("DefaultConnection");
services.AddDbContext<ApplicationDBContext>(options =>
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString),
b =>
{
b.MigrationsAssembly(typeof(ApplicationDBContext).Assembly.FullName);
b.MigrationsHistoryTable("__EHRMigrationsHistory");
options.UseMySql(connectionString, ServerVersion.AutoDetect(connectionString),
b =>
{
b.MigrationsAssembly(typeof(ApplicationDBContext).Assembly.FullName);
b.MigrationsHistoryTable("__EHRMigrationsHistory");
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<ApplicationDBContext>());
}),
ServiceLifetime.Transient);
return services;
}
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<ApplicationDBContext>());
}
var connectionStringExam = configuration.GetConnectionString("ExamConnection");
services.AddDbContext<ApplicationDBExamContext>(options =>
options.UseMySql(connectionStringExam, ServerVersion.AutoDetect(connectionStringExam),
b =>
{
b.MigrationsAssembly(typeof(ApplicationDBExamContext).Assembly.FullName);
b.MigrationsHistoryTable("__EHRMigrationsHistory");
}),
ServiceLifetime.Transient);
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<ApplicationDBExamContext>());
return services;
}
}
}

View file

@ -0,0 +1,44 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.Documents;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Models.OrganizationEmployee;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Organizations.Report2;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Domain.Models.Probation;
using BMA.EHR.Domain.Models.Retirement;
using BMA.EHR.Domain.ModelsExam.Candidate;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Infrastructure.Persistence
{
public class ApplicationDBExamContext : DbContext, IApplicationDBContext
{
#region " From Existing Database "
public DbSet<Candidate> Candidates { get; set; }
public DbSet<Career> Careers { get; set; }
public DbSet<Education> Educations { get; set; }
public DbSet<PeriodExam> PeriodExams { get; set; }
public DbSet<PositionExam> PositionExams { get; set; }
#endregion
public ApplicationDBExamContext(DbContextOptions<ApplicationDBExamContext> options) : base(options)
{
}
public Task<int> SaveChangesAsync()
{
return base.SaveChangesAsync();
}
public void Attatch<T>(T entity) where T : class
{
Attach(entity);
}
}
}