public ExpandoObject AutoMap() { var item = new ExpandoObject(); var fields = DataReaderHelper.GetDataReaderFields(_dbCommandData.Reader); var itemDictionary = (IDictionary <string, object>)item; foreach (var column in fields) { var value = DataReaderHelper.GetDataReaderValue(_dbCommandData.Reader, column.Index, true); itemDictionary.Add(column.Name, value); } return(item); }
public void AutoMap(object item) { var properties = ReflectionHelper.GetProperties(item.GetType()); var fields = DataReaderHelper.GetDataReaderFields(_dbCommandData.Reader); foreach (var field in fields) { if (field.IsSystem) { continue; } var value = _dbCommandData.Reader.GetValue(field.Index); var wasMapped = false; PropertyInfo property = null; if (properties.TryGetValue(field.LowerName, out property)) { SetPropertyValue(field, property, item, value); wasMapped = true; } else { if (field.LowerName.IndexOf('_') != -1) { wasMapped = HandleComplexField(item, field, value); } } if (!wasMapped && !_dbCommandData.ContextData.IgnoreIfAutoMapFails) { throw new FluentDataException("Could not map: " + field.Name); } } }
public DynamicTypeAutoMapper(System.Data.IDataReader reader) { idataReader_0 = reader; list_0 = DataReaderHelper.GetDataReaderFields(idataReader_0); }
public DynamicTypeAutoMapper(System.Data.IDataReader reader) { _reader = reader; _fields = DataReaderHelper.GetDataReaderFields(_reader); }