You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
940 B
27 lines
940 B
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ex_042_011_SinglePropertyNavigation_FluentAPI
|
|
{
|
|
class NounoursDBEntities : DbContext
|
|
{
|
|
public DbSet<Nounours> NounoursSet { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<Nounours>().HasKey(n => n.UniqueId);
|
|
modelBuilder.Entity<Nounours>().Property(n => n.UniqueId).ValueGeneratedOnAdd();
|
|
|
|
modelBuilder.Entity<Nounours>().Property(n => n.DateDeNaissance).HasColumnName("Naissance").HasColumnType("date");
|
|
|
|
modelBuilder.Entity<Nounours>().HasOne(n => n.Information);
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
}
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
optionsBuilder.UseSqlite($"Data Source=ex_042_011_SinglePropertyNavigation_FluentAPI.Nounours.db");
|
|
}
|
|
}
|
|
}
|