I am completely new to WPF, so I am spending time trawling the web for examples and tutorials on how things should be done. I have concluded the way forward is to try and use the MVVM pattern as guidance for my application structure. I am completely comfortably with the theory if not with my technical ability. I have one or two questions, and hope you can perhaps point me in the right direction on a few matters regarding application design.
I wish to maintain a list of Customers. I have seen several examples of this. These involve loading a Customers repository containing a list of Customer object. A corresponding View and ViewModel for the Customers is created. As the user selects a Customer to edit, a View and ViewModel is created for the Customer object in the Customers collection. This keeps everything in sync when changes are made. My question is: My Customer Model is very complicated, it contains basic Customer information, name, address etc, but also attributes about the Customer, category lists, product profiles, target budgets etc. I want these to be available for edit in the Customer View, but don’t want the overhead of loading them into the Customers repository. I only want to load the extended Customer information when required, but have the Customer View updated with changes. What’s the best way to achieve this?
My second question is: If I split the Customer information across several Tabs, should I have a separate View and ViewModel for each Tab, or have a single View. What’s the best practice?
I think I will use Linq to SQL to handle the database processing. In a multiple user environment Customers may be add by several users at the same time. How do I reflect the new additions made by others users in my Customers repository? Do I have to reload it?
Any suggestions on handling database concurrency issues. If another user edits or deletes a Customer I am currently editing, what should happen when I try and save? I am familiar with Datasets and ADO.net, and handling any concurrency errors arising when using a DataAdapter, is there a similar method with Linq to SQL?
I appreciate there are lot of vague questions here. But I would be grateful of any guidance offered.
Regards Tim