public List <AbstractDataset> GetDataset(string datasetStore, string column, object value) { // TODO: think about search criterias var dbDatasets = StoreProvider.Search(datasetStore, column, value); var datasetType = Type.GetType($"BusinessLogic.Models.{datasetStore}"); var datasets = new List <AbstractDataset>(); foreach (var dbDataset in dbDatasets ?? new List <Dictionary <string, object> >()) { var dataset = Activator.CreateInstance(datasetType); foreach (var key in dbDataset.Keys) { var property = datasetType.GetProperty(key); if (property == null) { continue; } if (dbDataset[key] != DBNull.Value) { if (property.PropertyType == typeof(bool)) { property.SetValue(dataset, !dbDataset[key].Equals(0)); } else { var result = Convert.ChangeType(dbDataset[key], property.PropertyType); property.SetValue(dataset, result); } } } datasets.Add(dataset as AbstractDataset); } return(datasets); }