Jul 19, 2012 at 2:29 PM
Edited Jul 19, 2012 at 2:30 PM
From within a CustomersViewModel I open a CustomerViewModel using ShowDialog of the uiVisualizerService.
After ShowDialog returns I do a commit of my UnitOfWork. However, when this happens I see that the ValidateBusinessRules method of the CustomerViewModel is called again. I would suspect that this would no longer exist since the dialog has finished?
It's not a real problem, I now check the property IsClosed in ValidateBusinessRules so I don't validate when the viewmodel is closed. But I would like to understand why this is happening, so any enlightenment would be appreciated :)
The code in CustomersViewModel is as follows:
using (TimeLogUnitOfWork unitOfWork = new TimeLogUnitOfWork())
Customer customer = new Customer();
CustomerViewModel viewModel = new CustomerViewModel(customer);
IUIVisualizerService uiVisualizerService = GetService<IUIVisualizerService>();
if (uiVisualizerService.ShowDialog(viewModel) == true)
refreshData = true;
As soon as unitOfWork.Commit is called I see that ValidateBusinessRules of viewModel is still called.