- 初始化数据
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<ModelA>().HasData(param[] ModelA);//HasData括号内为添加的数据。ModelA是Model对象
modelBuilder.Entity<ModelB>().HasData(param[] ModelB);//HasData括号内为添加的数据。ModelB是Model对象
base.OnModelCreating(modelBuilder);
}
- 定义FluentAPI
参考https://www.cnblogs.com/seekdream/p/10641510.html