Entity Framework Core - How to handle Related Entity Mapping and Saving
问题 I have two related entity which is one-to-many relationship like below: class parent{ public string parentName{get;set;} public virtual ICollection<child> childs { get; set; } } class child{ public string childName{get;set;} public parent parent{get;set;} ["ForeignKey"] public int parentId {get; set;} } /// View Model class VMParent{ public string parentName{get;set;} /// a string array contains child name public string[] childlist { get; set; } } Suppose my parent currently contains 2 child