mirror of
https://github.com/DevExpress/netcore-winforms-demos.git
synced 2025-12-26 11:27:42 +00:00
33 lines
1.6 KiB
C#
33 lines
1.6 KiB
C#
using System;
|
|
using System.Linq;
|
|
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 {
|
|
/// <summary>
|
|
/// Represents the Customers collection view model.
|
|
/// </summary>
|
|
public partial class CustomerCollectionViewModel : CollectionViewModel<Customer, long, IDevAVDbUnitOfWork> {
|
|
|
|
/// <summary>
|
|
/// Creates a new instance of CustomerCollectionViewModel as a POCO view model.
|
|
/// </summary>
|
|
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
|
|
public static CustomerCollectionViewModel Create(IUnitOfWorkFactory<IDevAVDbUnitOfWork> unitOfWorkFactory = null) {
|
|
return ViewModelSource.Create(() => new CustomerCollectionViewModel(unitOfWorkFactory));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the CustomerCollectionViewModel class.
|
|
/// This constructor is declared protected to avoid undesired instantiation of the CustomerCollectionViewModel type without the POCO proxy factory.
|
|
/// </summary>
|
|
/// <param name="unitOfWorkFactory">A factory used to create a unit of work instance.</param>
|
|
protected CustomerCollectionViewModel(IUnitOfWorkFactory<IDevAVDbUnitOfWork> unitOfWorkFactory = null)
|
|
: base(unitOfWorkFactory ?? UnitOfWorkSource.GetUnitOfWorkFactory(), x => x.Customers, query => query.OrderBy(x => x.Name)) {
|
|
}
|
|
}
|
|
} |