Asp.net mvc entity framework code first associate foreign key with different name
问题 How can I associate a foreign key with different names here: createdby in post and UserID in users table. public class Post : IValidatableObject { [Key] public long PostID { get; set; } public long? ParentPostID { get; set; } [ForeignKey("CreatedBy")] public virtual User Users { get; set; } [ScaffoldColumn(false)] public DateTime? CreatedDate { get; set; } [ScaffoldColumn(false)] public long? CreatedBy { get; set; } } public class User { [Key] public long UserID { get; set; } [Required]