它在 SQLite 下工作
数据库上下文.cs
public class DbContext : DbContext
{
public DbContext(DbContextOptions<DbContext> options) : base(options)
{
}
public DbSet<User> Users { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
用户.cs
public class User : OAuthUser
{
public string FullName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
OAuthUser.cs
public class OAuthUser
{
public string Id { get; set; }
public string Email { get; set; }
public string UserName { get; set; }
public string PhoneNumber { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
然后我执行了Add-Migration和Database-Update。它应该更新到我机器上的 SQLServer …