34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Reflection.Emit;
|
|
using vita_asistente.Models;
|
|
|
|
namespace vita_asistente.Data
|
|
{
|
|
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
|
{
|
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
|
: base(options)
|
|
{
|
|
}
|
|
|
|
public DbSet<Pacientes> Pacientes { get; set; }
|
|
protected override void OnModelCreating(ModelBuilder builder)
|
|
{
|
|
base.OnModelCreating(builder);
|
|
|
|
builder.Entity<ApplicationUser>().ToTable("AspNetUsers");
|
|
|
|
//------Paciente----------------
|
|
builder.Entity<Pacientes>(entity =>
|
|
{
|
|
entity.HasKey(e => e.Id);
|
|
entity.Property(e => e.DocumentType).HasMaxLength(50).IsRequired();
|
|
entity.Property(e => e.DocumentNumber).HasMaxLength(20).IsRequired();
|
|
entity.Property(e => e.FirstName).HasMaxLength(100).IsRequired();
|
|
entity.Property(e => e.LastName).HasMaxLength(100).IsRequired();
|
|
} );
|
|
}
|
|
}
|
|
}
|