Suppose I have the following classes
public class Course
{
public int CourseID { get; set; }
public string Credits { get; set; }
public int DepartmentID { get; set; }
public virtual Department Department { get; set; }
public virtual ICollection<Department> Departments { get; set; }
}
public class Department
{
public int DepartmentID { get; set; }
public string Name { get; set; }
public decimal Budget { get; set; }
public DateTime StartDate { get; set; }
public int? Administrator { get; set; }
}
How can I populate data to instances of Course type (all properties) programmatically?
Please do not suggest a specific library. I want to learn the technique by Reflection or Roslyn.
Aucun commentaire:
Enregistrer un commentaire