【问题标题】:Can i create multiple tables using same model in EF core asp.net我可以在 EF core asp.net 中使用相同的模型创建多个表吗
【发布时间】:2019-05-18 00:31:12
【问题描述】:

我可以使用相同的模型和 EF Core 创建多个表吗?我要求使用相同的模型创建多个表(具有不同的名称)并且它们不需要共享任何信息。使用 asp.net core 中的 Entity Framework Core 可以做到这一点吗?

【问题讨论】:

标签: c# sql asp.net entity-framework-core


【解决方案1】:

不,你不能,这样做的愿望通常是数据库设计的味道。考虑重新设计您的表格布局。也许添加一列来区分记录会有所帮助。

另见GitHub aspnet/EntityFrameworkCore #7299: Using the same class (model) to create two tables

【讨论】:

    【解决方案2】:

    Multiple Tables With Same Structure Entity Framework

    我想以上内容可能会对你有所帮助。

    【讨论】:

      猜你喜欢
      • 2017-05-21
      • 1970-01-01
      • 1970-01-01
      • 2020-11-25
      • 1970-01-01
      • 2020-10-24
      • 2020-01-22
      • 1970-01-01
      • 2022-12-28
      相关资源
      最近更新 更多