c# - Entity Framework loading foreign keys with HasOptional -


Is it possible to load ProjectManager by the foreign key

  this.HasOptional (t = & gt; t.ProjectManager) .WithCascadeOnDelete (false)  

I tried to do the following, and ProjectManager still looks like null

  var entities = _context.EodRecords .include (r = & gt; r.ProjectManager). (R = & gt; r.RecordLanguages). (Include R = & gt; R section);  

You do not specify foreign keys

  This.HasOptional (t = & gt; T.Project Manager) with MAY (). Isigni (t = & gt; t.project managerid) .WillCascadeOnDelete (wrong); Based on your error,  

Contexts.Record_ProjectManager :: 'Record_ProjectManager' relationship in relationship with multiparty conflict in the 'Record_ProjectManager_Target' reference barrier. Because all the qualities in the dependent role are non-futile, the multiplication of the main role should be '1'.

Make sure your FK is a tap

  public virtual int? ProjectManagerId {get; Set; }  

Comments