SqlLiteと.netコアを使用しているim。同じクラス(モデル)を再利用して2つのテーブルを作成するにはどうすればよいですか?
public class Venda
{
public int ID { get; set; }
public int MasterID { get; set; }
public int UsuarioID { get; set; }
public int Status { get; set; }
}
/* ********************************************** */
public class MyEntities : DbContext
{
public DbSet<Venda> VendasRecebidas { get; set; } //Table one
public DbSet<Venda> VendasTemp { get; set; } //Table two
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Filename=./mydb.db");
}
}
C#継承の使用
public class VendaRecebida
{
public int ID { get; set; }
public int MasterID { get; set; }
public int UsuarioID { get; set; }
public int Status { get; set; }
}
public class VendaTemp : VendaRecebida
{
}
/* ********************************************** */
public class MyEntities : DbContext
{
public DbSet<VendaRecebida> VendasRecebida { get; set; } //Table one
public DbSet<VendaTemp> VendasTemp { get; set; } //Table two
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加