15 lines
421 B
C#
15 lines
421 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using SimpleTodoApiWithPg.Models; // 引入 Todo 模型
|
|
|
|
namespace SimpleTodoApiWithPg.Data
|
|
{
|
|
public class AppDbContext : DbContext
|
|
{
|
|
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
|
|
{
|
|
}
|
|
|
|
// 定义一个 DbSet 属性,对应数据库中的 Todos 表
|
|
public DbSet<Todo> Todos { get; set; } = default!;
|
|
}
|
|
} |