21 lines
561 B
C#
21 lines
561 B
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Server.SQL
|
|
{
|
|
public abstract class SQL<T> : DbContext where T : class
|
|
{
|
|
|
|
public abstract DbSet<T> Table { get; set; }
|
|
|
|
protected abstract string ConnectionString { get; }
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
{
|
|
optionsBuilder.UseNpgsql(ConnectionString);
|
|
// 다른 옵션들을 추가할 수 있습니다.
|
|
}
|
|
}
|
|
}
|
|
} |