Hey Phil,
I was going through articles online and found a concept called “Buddy” classes. Here is the code I just wrote but not tested till yet:
New Class:
namespace Test
{
public class StudentMetaData
{
[Required()]
public int StudentID { get; set; }
public string FullName { get; set; }
}
}
Modified generated class:
namespace Test
{
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
[MetadataType(typeof(StudentMetaData))]
public partial class Student
{
public Student()
{
this.Enrollments = new HashSet<Enrollment>();
}
public int StudentID { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public System.DateTime EnrollmentDate { get; set; }
public virtual ICollection<Enrollment> Enrollments { get; set; }
}
}
thanks