/// <summary> /// Read data from db result /// </summary> /// <param name="reader">DB reader</param> public override void DbRead(IDbDataReader reader) { base.DbRead(reader); ParamName = reader.ReadString(nameof(ParamName)); ParamType = SimpleConvert.Convert <SqlDbType>(reader.ReadString(nameof(ParamType))); TypeLength = reader.ReadInt16(nameof(TypeLength)); TypePrecision = reader.ReadByte(nameof(TypePrecision)); IsNullable = SimpleConvert.Convert <bool>(reader.ReadInt32(nameof(IsNullable))); OrderId = reader.ReadInt16(nameof(OrderId)); Collation = reader.ReadStringN(nameof(Collation)); }
/// <summary> /// Read/Write enum value /// </summary> /// <typeparam name="TEnum">Runtime type of Enum</typeparam> /// <param name="fieldName">Name of the De/Serialized field</param> /// <param name="value">Value to Serialize</param> /// <returns>Readed value</returns> public TEnum ReadWriteEnum <TEnum>(string fieldName, TEnum value) where TEnum : Enum { if (IsWrite) { int numberValue = SimpleConvert.Convert <int>(value); Writer !.WriteInt32(fieldName, numberValue); } else { int numberValue = Reader !.ReadInt32(fieldName); value = SimpleConvert.Convert <TEnum>(numberValue); } return(value); }
/// <summary> /// Read data from db result /// </summary> /// <param name="reader">DB reader</param> public virtual void DbRead(IDbDataReader reader) { SchemaName = reader.ReadString(nameof(SchemaName)); ObjectName = reader.ReadString(nameof(ObjectName)); ObjectType = SimpleConvert.Convert <MsSqlDbObjectType>(reader.ReadString(nameof(ObjectType))); }