Skip to main content
2 of 2
added link
JanDotNet
  • 8.5k
  • 2
  • 20
  • 48
  1. The methods should return Task instead of void. 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

  1. 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) { ... }
  1. 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.

JanDotNet
  • 8.5k
  • 2
  • 20
  • 48