体验一下aspweb的功能和用法!!!
This commit is contained in:
15
Data/AppDbContext.cs
Normal file
15
Data/AppDbContext.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
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!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user