- The methods should return
Task
instead ofvoid
. Otherwise exception are shallowed. Alternative you could encapsulate the whole content of the method in a try catch block.
See also: Asynchrone return types - Void Return Type
- Try to follow the DRY principle.
For example the line:
new List<ExpandoObject>(_dataPreparer.GetResults()).ToDataTable().AsDataView();
may be extracted to a method:
private static IList<ExpandoObject> GetData(DataPreparer dataPreparer) { ... }
- It seems that the instance variables
_dataPreparer
,_activeDirectorySearcher
class variables are set / used from different methods. That increases the comlexity of the program flow. I would try to avoid such 'global writable states'.
The view model seems to be used as universal container with high coupling. In the medium term, I would try to move the logic of each method to a single class that is independent of the view model.