Cześć jestem po prostu nauczyć się pracować z Entity Framework kod najpierw, a ja nie potrafię zrozumieć something.I stworzyli trzy modele oparte na tutorialu:Zrozumienie kod najpierw właściwości wirtualne
public class Course
{
public int CourseID { get; set; }
public string Title { get; set; }
public int Credits { get; set; }
public virtual ICollection<Enrollment> Enrollments{ get; set; }
}
public class Enrollment
{
public int EnrollmentID { get; set; }
public int CourseID { get; set; }
public int StudentID { get; set; }
public decimal? Grade { get; set; }
public virtual Course Course { get; set; }
public virtual Student Student { get; set; }
}
public class Student
{
public int StudentID { get; set; }
public string LastName { get; set; }
public string FirstMidName { get; set; }
public DateTime EnrollmentDate { get; set; }
public virtual ICollection<Enrollment> Enrollments { get; set; }
}
Moim problemem jest to, że Nie rozumiem, jakie właściwości mają właściwości wirtualne. Jeśli sprawdzam bazę danych, nie ma skrzynki kolumnowej dla każdej z właściwości, tylko dla pozostałych.
Co się dzieje, gdy tworzysz nieruchomość z wirtualnym słowem kluczowym?
W pracy z Entity Framework jest o wiele więcej. Jest to na przykład potrzebne przez leniwy mechanizm ładowania Entity Framework. Zobacz: http://stackoverflow.com/questions/7738722/entity-framework-4-1-virtual-properties –
@Ravadre Dzięki, zaktualizowałem mój post. – Freeman