Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WPF MVVM Data Laher Question
Message
From
25/04/2011 12:40:10
John Baird
Coatesville, Pennsylvania, United States
 
General information
Forum:
ASP.NET
Category:
Class design
Miscellaneous
Thread ID:
01508313
Message ID:
01508315
Views:
61
>I'm developing a WPF app using MVVM. I have created a Models project and a Data Layer project. The Data Layer creates, populates, and returns model objects.
>
>The question is, assume a one to many relationship such as an invoice header and invoice line items. The InvoiceHeaderModel has a list property of type InvoiceDetailModel. Where's the right place to populate this?
>
>If you do it in the model, maybe with lazy loading, then you create a dependency between the Model project into the Data Layer project. The Data Layer project knows about the Model project, but not the other way around. And, if you lazy load the child properties, then you have code in the models.
>
>The only other place I can see it would be to have a method in the DL, say GetInvoiceDetails(InvoiceHeaderModel Header) that gets the details for the invoice and populates the header model's details property.
>
>What do you think?

I use the ViewModel to hydrate my properties that are eventually bound to the view trhough function calls to the model.
Previous
Reply
Map
View

Click here to load this message in the networking platform