Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WPF MVVM Data Laher Question
Message
General information
Forum:
ASP.NET
Category:
Class design
Title:
WPF MVVM Data Laher Question
Miscellaneous
Thread ID:
01508313
Message ID:
01508313
Views:
118
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?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Next
Reply
Map
View

Click here to load this message in the networking platform