DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.Locations/Db/LocationDbContext.cs

27 lines
752 B
C#
Raw Normal View History

2023-08-15 22:52:30 -05:00
using Microsoft.EntityFrameworkCore;
namespace DamageAssesment.Api.Locations.Db
{
public class LocationDbContext : DbContext
2023-08-15 22:52:30 -05:00
{
public DbSet<Db.Location> Locations { get; set; }
public DbSet<Db.Region> Regions { get; set; }
public LocationDbContext(DbContextOptions options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<Location>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
modelBuilder.Entity<Region>()
.Property(item => item.Id)
.ValueGeneratedOnAdd();
}
2023-08-15 22:52:30 -05:00
}
}