using System; using System.Linq; using System.Linq.Expressions; using System.Collections.Generic; using System.Collections.ObjectModel; using DevExpress.Mvvm; using DevExpress.Mvvm.POCO; using DevExpress.DevAV.Common.Utils; using DevExpress.DevAV.DevAVDbDataModel; using DevExpress.Mvvm.DataModel; using DevExpress.DevAV; using DevExpress.DevAV.Common.ViewModel; namespace DevExpress.DevAV.ViewModels { /// /// Represents the single Employee object view model. /// public partial class EmployeeViewModel : SingleObjectViewModel { /// /// Creates a new instance of EmployeeViewModel as a POCO view model. /// /// A factory used to create a unit of work instance. public static EmployeeViewModel Create(IUnitOfWorkFactory unitOfWorkFactory = null) { return ViewModelSource.Create(() => new EmployeeViewModel(unitOfWorkFactory)); } /// /// Initializes a new instance of the EmployeeViewModel class. /// This constructor is declared protected to avoid undesired instantiation of the EmployeeViewModel type without the POCO proxy factory. /// /// A factory used to create a unit of work instance. protected EmployeeViewModel(IUnitOfWorkFactory unitOfWorkFactory = null) : base(unitOfWorkFactory ?? UnitOfWorkSource.GetUnitOfWorkFactory(), x => x.Employees, x => x.FullName) { } /// /// The view model that contains a look-up collection of Pictures for the corresponding navigation property in the view. /// public IEntitiesViewModel LookUpPictures { get { return GetLookUpEntitiesViewModel((EmployeeViewModel x) => x.LookUpPictures, x => x.Pictures); } } /// /// The view model that contains a look-up collection of Probations for the corresponding navigation property in the view. /// public IEntitiesViewModel LookUpProbations { get { return GetLookUpEntitiesViewModel((EmployeeViewModel x) => x.LookUpProbations, x => x.Probations); } } /// /// The view model for the EmployeeAssignedTasks detail collection. /// public CollectionViewModel EmployeeAssignedTasksDetails { get { return GetDetailsCollectionViewModel((EmployeeViewModel x) => x.EmployeeAssignedTasksDetails, x => x.Tasks, x => x.AssignedEmployeeId, (x, key) => x.AssignedEmployeeId = key); } } /// /// The view model for the EmployeeOwnedTasks detail collection. /// public CollectionViewModel EmployeeOwnedTasksDetails { get { return GetDetailsCollectionViewModel((EmployeeViewModel x) => x.EmployeeOwnedTasksDetails, x => x.Tasks, x => x.OwnerId, (x, key) => x.OwnerId = key); } } /// /// The view model for the EmployeeEvaluations detail collection. /// public CollectionViewModel EmployeeEvaluationsDetails { get { return GetDetailsCollectionViewModel((EmployeeViewModel x) => x.EmployeeEvaluationsDetails, x => x.Evaluations, x => x.EmployeeId, (x, key) => x.EmployeeId = key); } } } }