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.
30 lines
1.2 KiB
30 lines
1.2 KiB
using System.Collections.Generic;
|
|
using Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace DbContextLib
|
|
{
|
|
public class LibraryContext : DbContext
|
|
{
|
|
// DbSet<BookEntity> est une propriété dans le contexte de base de données (DbContext) qui représente une table de livres dans la base de données.
|
|
public DbSet<UserEntity> Users { get; set; }
|
|
public DbSet<GroupEntity> Groups { get; set; }
|
|
public DbSet<LangueEntity> Langue { get; set; }
|
|
public DbSet<RoleEntity> Roles { get; set; }
|
|
public DbSet<TranslateEntity> Translates { get; set; }
|
|
public DbSet<VocabularyEntity> Vocabularys { get; set; }
|
|
public DbSet<VocabularyListEntity> vocabularyListEntities { get; set; }
|
|
//permet de créer une base de donnée (fichier .db) ici en Sqlite avec le nom Db.Books.db
|
|
|
|
|
|
public LibraryContext(DbContextOptions<LibraryContext> options): base(options)
|
|
{
|
|
}
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
optionsBuilder.UseSqlite($"Data Source=Db.in_english_please.db");
|
|
}
|
|
}
|
|
}
|