Is it possible to change the display name of EntitySet fields?

575 Views Asked by At

Every foreign key is defined as a EntitySet in Dynamic Data. Is it possible to change the display name of these EntitySet fields?

1

There are 1 best solutions below

6
On

Yes. Suppose you have a Course with a foreign key CourseType. You can apply the DisplayAttribute to courses:

[MetadataType(typeof(CourseMetadata))]
[DisplayName("Courses")]
public partial class Course 
{}

public class CourseMetadata
{
    [ScaffoldColumn(false)]
    public object CourseTypeId { get; set; }

    [Display(Name = "Course Type")]
    public object CourseType { get; set; }
}