Referring to this previous post: How to add description to columns in Entity Framework 4.3 code first using migrations?
I have successfully implemented the modified solution proposed by user Abdullah but I have encountered the exception below:
System.Data.SqlClient.SqlException HResult=0x80131904 Message=Object
is invalid. Extended properties are not permitted on
'dbo.School.Students', or the object does not exist.
Sample code as below:
public class School
{
public School()
{
Students = new HashSet<Student>();
}
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public Guid Id { get; set; }
[Description("Some Text")]
public string Description { get; set; }
[Description("Some text")]
public ICollection<Student> Students{ get; set; }
}
I understand from the exception message, there is no column generated for Students. Checking the DB shows that the Student table have the column SchoolId as FK.
So the question here is: how do I go about adding/updating the FK description when EF generates the FK column in another table?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…