Ajout du dbContext

This commit is contained in:
2025-07-26 12:11:52 +00:00
parent 27899813e0
commit 354c25ac06
2 changed files with 43 additions and 0 deletions

28
Models/StrapiContext.cs Normal file
View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace administration.Models;
public partial class StrapiContext : DbContext
{
public StrapiContext()
{
}
public StrapiContext(DbContextOptions<StrapiContext> options)
: base(options)
{
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseNpgsql("Host=postgres;Port=5432;Database=strapi;Username=strapi;Password=Mf33ksTRLrPKSqQ4cTXitgiSN6BPBt89");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}