Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Flatten/expand columns of Navigation Property for ViewModel?
- class Employee
- {
- [Key]
- public int EmployeeKey {get;set;}
- public string EmployeeName { get; set; }
- public int CurrentEmployeeChangeKey { get; set; }
- [ForeignKey("CurrentEmployeeChangeKey")]
- public virtual EmployeeChange CurrentEmployeeChange {
- get { return EmployeeChanges.FirstOrDefault() ; } /*set;*/ }
- public virtual ICollection<EmployeeChange> EmployeeChanges { get; set; }
- }
- class EmployeeChange
- {
- [Key]
- public int EmployeeChangeKey { get; set; }
- public int EmployeeKey { get; set; }
- [ForeignKey("EmployeeKey")]
- public virtual Employee Employee { get; set; }
- public string EmployeeStreet { get; set; }
- public string EmployeeCity { get; set; }
- public string Etc { get; set; }
- public DateTime ChangeEffective { get; set; }
- }
- class EmployeeCurrentChange
- {
- public string EmployeeName { get; set; }
- public string EmployeeStreet { get; set; }
- public string EmployeeCity { get; set; }
- public string Etc { get; set; }
- public DateTime ChangeEffective { get; set; }
- //I don't need the below properties in the result, but if they
- //happen to be there I don't mind.
- public int EmployeeKey { get; set; }
- [ForeignKey("EmployeeKey")]
- public virtual Employee Employee { get; set; }
- [Key]
- public int EmployeeKey {get;set;}
- public int CurrentEmployeeChangeKey { get; set; }
- [ForeignKey("CurrentEmployeeChangeKey")]
- public virtual EmployeeChange CurrentEmployeeChange {
- get { return EmployeeChanges.FirstOrDefault() ; } /*set;*/ }
- public virtual ICollection<EmployeeChange> EmployeeChanges { get; set; }
- [Key]
- public int EmployeeChangeKey { get; set; }
- }
Add Comment
Please, Sign In to add comment