private static IDataExtractor <T> ExtractProperty <T>(IDataExtractor <T> extractor, PropertyInfo property) where T : class, new() { if (property.PropertyType == typeof(string)) { return(extractor.WithProperty(ExpressionGenerator <T> .GetStringProperty(property), property.ToColumn())); } if (property.PropertyType == typeof(int)) { return(extractor.WithProperty(ExpressionGenerator <T> .GetIntProperty(property), property.ToColumn())); } if (property.PropertyType == typeof(int?)) { return(extractor.WithProperty(ExpressionGenerator <T> .GetNullableIntProperty(property), property.ToColumn())); } if (property.PropertyType == typeof(DateTime)) { return(extractor.WithProperty(ExpressionGenerator <T> .GetDateTimeProperty(property), property.ToColumn())); } if (property.PropertyType == typeof(DateTime?)) { return(extractor.WithProperty(ExpressionGenerator <T> .GetNullableDateTimeProperty(property), property.ToColumn())); } if (property.PropertyType == typeof(bool)) { return(extractor.WithProperty(ExpressionGenerator <T> .GetBooleanProperty(property), property.ToColumn())); } if (property.PropertyType == typeof(bool?)) { return(extractor.WithProperty(ExpressionGenerator <T> .GetNullableBooleanProperty(property), property.ToColumn())); } throw new ArgumentException($"Unknown type {property.PropertyType}"); }