EF Core在传统连接表中苦苦挣扎

我有一个现有的MySql数据库,其中有2个表,这些表具有旧的联接表。 “ RequisitionId”和“ PanelId”都被设置为“ RequisitionPanel”表上的索引。

      public class Requisition
      {
        public int Id { get; set; }
        // Some other properties
      }

      public class Panel
      {
        public int Id { get; set;}
        // Some other properties
      }

      public class RequisitionPanel
      {
        public int RequisitionId { get; set; }    
        public int PanelId { get; set; }
        public string PanelDescription { get; set; }
      }

在流利的API中,我正在使用

   modelBuilder.Entity<RequisitionPanel>().HasKey(r => new { 
   r.RequisitionId,r.PanelId });  

我收到的错误是

  The property 'RequisitionId' on entity type 'RequisitionPanel' has a temporary value. Either set a permanent value explicitly or ensure that the database is configured to generate values for this property.

我没有运气就尝试了几种不同的方法。  任何关于我要去哪里的建议都将不胜感激。

谢谢

cx3232 回答:EF Core在传统连接表中苦苦挣扎

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3034858.html

大家都在问