/// <inheritdoc /> public override object GetPropertyValue(int propertyIndex) { if (this.metadata == null) { this.metadata = ValueReaderCreator.GetPropertyMetadataForType(this.GetType()); } if (this.metadata.Length < propertyIndex) { throw new ArgumentOutOfRangeException( string.Format(CultureInfo.InvariantCulture, "Number of Property: {0}. Trying to access Index: {1}", this.metadata.Length, propertyIndex)); } switch (this.metadata[propertyIndex].Type) { case DataType.Int32: return(this.PropertyValueReader.ReadInt32At(propertyIndex)); case DataType.Guid: return(this.PropertyValueReader.ReadGuidAt(propertyIndex)); case DataType.Byte: return(this.PropertyValueReader.ReadByteAt(propertyIndex)); case DataType.Ushort: return((ushort)this.PropertyValueReader.ReadInt16At(propertyIndex)); case DataType.Uint: return((uint)this.PropertyValueReader.ReadInt32At(propertyIndex)); case DataType.Int64: return(this.PropertyValueReader.ReadInt64At(propertyIndex)); case DataType.Boolean: return(this.PropertyValueReader.ReadBoolAt(propertyIndex)); case DataType.Double: return(this.PropertyValueReader.ReadDoubleAt(propertyIndex)); case DataType.String: return(this.PropertyValueReader.ReadUnicodeStringAt(propertyIndex)); case DataType.DateTime: return(this.PropertyValueReader.ReadDateTimeAt(propertyIndex)); default: return(new NotSupportedException( string.Format(CultureInfo.InvariantCulture, "Unknown/Unsupported Data Type: {0}", this.metadata[propertyIndex].Type))); } }
/// <inheritdoc /> public override IEnumerable <PropertyDescriptor> GetPropertyDescriptors() { if (this.metadata == null) { this.metadata = ValueReaderCreator.GetPropertyMetadataForType(this.GetType()); } return(this.metadata.Select( item => new PropertyDescriptor() { Index = item.AttributeData.Index, OriginalName = item.AttributeData.OriginalName, FinalType = item.Type, Name = item.Name })); }