For example, lets say I had this object that I wanted to put into a SQL database with EntityFramework:
public class Shift
{
public Guid Id { get; set; }
public Attendance Attendance { get; set; }
public Managers Managers { get; set; }
// other properties
}
public class Attendance
{
public int AM { get; set; }
public int MidDay { get; set; }
public int PM { get; set; }
}
public class Managers
{
public string AM { get; set; }
public string MidDay { get; set; }
public string PM { get; set; }
}
Normally, I would figure this cannot be done, and I would just flatten everything into a simple collection of properties:
public class Shift
{
public Guid Id { get; set; }
public int Attendance_AM { get; set; }
public int Attendance_MidDay { get; set; }
public int Attendance_PM { get; set; }
public string Managers_AM { get; set; }
public string Managers_MidDay { get; set; }
public string Managers_PM { get; set; }
}
But is there a way to make EF store the complex object as a single table?
EDIT
This might help illustrate my question.
The goal is to have both code blocks above, work with the same Table in SQL:
