创建数据库
创建文件夹
./Context
创建文件
./Context/BaseEnity.cs
./Context/Memo.cs
./Context/MyTodoContext.cs
./Context/Todo.cs
./Context/User.cs
创建数据对象
-
./Context/BaseEnity.cs
namespace MyToDo.Api.Context { public class BaseEnity { public int Id { get; set; } public DateTime CreateDate { get; set; } public DateTime UpdateDate { get; set; } } }
-
./Context/Memo.cs
namespace MyToDo.Api.Context { public class Memo:BaseEnity { public string Title { get; set; } public string Content { get; set; } } }
-
./Context/MyTodoContext.cs
创建数据库DbSet
using Microsoft.EntityFrameworkCore; namespace MyToDo.Api.Context