Паттерны быстрой разработки WPF MVVM бизнес-приложений.
(Несколько типовых задач, возникающих при разработке бизнес-‐приложений на платформе WPF,
и эффективные способы решения этих задач, воплощенные в
DevExpress Scaffolding Wizard -‐ инструменте быстрой разработки CRUD и LOB приложений.)
1. Бизнес-‐приложения, CRUD-‐приложения, DevExpress Scaffolding.
2. Навигация в приложении. 3. Простая асинхронная загрузка данных. 4. Асинхронная загрузка данных и lazy loading navigaYon properYes.
5. Instant Feedback Mode 6. Формы редактирования. WPF bindings and EnYty Framework objects.
Приложения
CRUD-‐приложения
Приложения, созданные с помощью DevExpress Scaffolding Wizard
CRUD-‐приложения
CRUD-‐приложения
Структура наскафолженного приложения
IDocumentManagerService IDocument CreateDocument(
string documentID, object parentViewModel);
IDocument ActiveDocument { get; }
IEnumerable<IDocument> Documents { get; }
IDocument object Content { get; }
void Close();
Навигация.
IDocumentManagerService IDocument CreateDocument(
string documentID, object parentViewModel);
IDocument ActiveDocument { get; }
IEnumerable<IDocument> Documents { get; }
IDocument object Content { get; }
void Close();
Навигация.
Main View Model
EnYty CollecYon View Model
EnYty View Model
Tabbed MDI DocumentManagerService
Навигация.
Tabbed MDI DocumentManagerService
Main View Model
EnYty CollecYon View Model
EnYty View Model
Windowed DocumentManagerService
Навигация.
Простая асинхронная загрузка.
Асинхронная загрузка и EnYty Framework.
class Order { long Id; decimal Discount; decimal UnitPrice; byte[] Picture; int Quantity; long ProductId; virtual Product Product; }
class Product { long Id; string Name; byte[] Picture; string QuantityPerUnit; double UnitPrice; string Description; }
class OrderInfo { long Id; decimal UnitPrice; int Quantity; string ProductName; }
Id = x.Id
UnitPrice = x.UnitPrice
QuanYty = x.QuanYty
ProductName = x.ProductName
.Select(x => new OrderInfo() { … }) Repository EnYty ProjecYon EnYty
Data Layer
View Model
Data Grid Control
IQueryable
Async Loading
ObservableCollecYon
Data Layer
View Model
Data Grid Control
IQueryable
EnYty
SelectedItem ItemsSource SelectedItem ItemsSource
Async Loading
SelectedEnYty SelectedEnYty
Instant Feedback Mode.
EnYty Framework. Редактирование enYty.
• Обновление эдиторов на форме при изменении свойства enYty
<dxe:TextEdit EditValue="{Binding Entity.Name, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnSourceUpdated=True}" />
• Обновление состояния вьюмодели при изменении enYty эдитором
<dxe:TextEdit EditValue="{Binding Entity.Name, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnSourceUpdated=True}" />