/// <summary> /// Specifies SQL Server DECIMAL data type for column. /// </summary> /// <param name="column">The column.</param> /// <param name="precision">The precision of the data type.</param> /// <param name="scale">The scale of the data type.</param> /// <returns>This column for fluent coding.</returns> public static _Decimal AsSqlDecimal(this _Decimal column, byte precision = DEFAULT_DECIMAL_PRECISION, byte scale = DEFAULT_DECIMAL_SCALE) { column.VerifyNotNull(nameof(column)); if (precision < MIN_DECIMAL_PRECISION || precision > MAX_DECIMAL_PRECISION) { throw new ArgumentOutOfRangeException(nameof(precision)); } if (scale < 0 || scale > precision) { throw new ArgumentOutOfRangeException(nameof(scale)); } column.SetSqlType(SqlType.Decimal(column, precision, scale)); return(column); }
public void Column_intercepted_MySqlType() { { var binary = new _Binary().AsMySqlBinary(255); VerifyMySqlType(MySqlVersion.LowestSupported, binary, MySqlDbType.Binary, 255, "BINARY(255)"); } { var varBinary = new _Binary().AsMySqlVarBinary(4000); VerifyMySqlType(MySqlVersion.LowestSupported, varBinary, MySqlDbType.VarBinary, 4000, "VARBINARY(4000)"); } { var binary = new _Binary().AsMySqlTinyBlob(); VerifyMySqlType(MySqlVersion.LowestSupported, binary, MySqlDbType.TinyBlob, "TINYBLOB"); } { var binary = new _Binary().AsMySqlBlob(); VerifyMySqlType(MySqlVersion.LowestSupported, binary, MySqlDbType.Blob, "BLOB"); } { var binary = new _Binary().AsMySqlMediumBlob(); VerifyMySqlType(MySqlVersion.LowestSupported, binary, MySqlDbType.MediumBlob, "MEDIUMBLOB"); } { var binary = new _Binary().AsMySqlLongBlob(); VerifyMySqlType(MySqlVersion.LowestSupported, binary, MySqlDbType.LongBlob, "LONGBLOB"); } { var timestamp = new _DateTime().AsMySqlTimestamp(); VerifyMySqlType(MySqlVersion.LowestSupported, timestamp, MySqlDbType.Timestamp, "TIMESTAMP"); } { var decimalColumn = new _Decimal().AsMySqlDecimal(28, 8); VerifyMySqlType(MySqlVersion.LowestSupported, decimalColumn, MySqlDbType.Decimal, "DECIMAL(28, 8)", 28, 8); } { var money = new _Decimal().AsMySqlMoney(); VerifyMySqlType(MySqlVersion.LowestSupported, money, MySqlDbType.Decimal, "DECIMAL(19, 4)", 19, 4); } { var date = new _DateTime().AsMySqlDate(); VerifyMySqlType(MySqlVersion.LowestSupported, date, MySqlDbType.Date, "DATE"); } { var time = new _DateTime().AsMySqlTime(); VerifyMySqlType(MySqlVersion.LowestSupported, time, MySqlDbType.Time, "TIME"); } { var dateTime = new _DateTime().AsMySqlDateTime(); VerifyMySqlType(MySqlVersion.LowestSupported, dateTime, MySqlDbType.DateTime, "DATETIME"); } { var charColumn = new _String().AsMySqlChar(255, "utf8mb4"); VerifyMySqlType(MySqlVersion.LowestSupported, charColumn, MySqlDbType.String, 255, "CHAR(255) CHARACTER SET utf8mb4"); } { var varchar = new _String().AsMySqlVarChar(512, "utf8mb4"); VerifyMySqlType(MySqlVersion.LowestSupported, varchar, MySqlDbType.VarString, 512, "VARCHAR(512) CHARACTER SET utf8mb4"); } { var singleChar = new _Char().AsMySqlChar(); VerifyMySqlType(MySqlVersion.LowestSupported, singleChar, MySqlDbType.String, 1, "CHAR(1)"); singleChar = new _Char().AsMySqlChar("utf8mb4"); VerifyMySqlType(MySqlVersion.LowestSupported, singleChar, MySqlDbType.String, 1, "CHAR(1) CHARACTER SET utf8mb4"); } { var text = new _String().AsMySqlTinyText("utf8mb4"); VerifyMySqlType(MySqlVersion.LowestSupported, text, MySqlDbType.TinyText, "TINYTEXT CHARACTER SET utf8mb4"); } { var text = new _String().AsMySqlText("utf8mb4"); VerifyMySqlType(MySqlVersion.LowestSupported, text, MySqlDbType.Text, "TEXT CHARACTER SET utf8mb4"); } { var text = new _String().AsMySqlMediumText("utf8mb4"); VerifyMySqlType(MySqlVersion.LowestSupported, text, MySqlDbType.MediumText, "MEDIUMTEXT CHARACTER SET utf8mb4"); } { var text = new _String().AsMySqlLongText("utf8mb4"); VerifyMySqlType(MySqlVersion.LowestSupported, text, MySqlDbType.LongText, "LONGTEXT CHARACTER SET utf8mb4"); } }
public TotalDueConditionalFormat(_Decimal totalAmt) { _totalAmt = totalAmt; }
/// <summary> /// Specifies SQL Server MONEY data type for column. /// </summary> /// <param name="column">The column.</param> /// <returns>This column for fluent coding.</returns> public static _Decimal AsSqlMoney(this _Decimal column) { column.VerifyNotNull(nameof(column)); column.SetSqlType(SqlType.Money(column)); return(column); }
public void Column_intercepted_SqlType() { { var binary = new _Binary().AsSqlBinary(500); VerifySqlType(SqlVersion.Sql13, binary, SqlDbType.Binary, 500, "BINARY(500)"); } { var binaryMax = new _Binary().AsSqlBinaryMax(); VerifySqlType(SqlVersion.Sql13, binaryMax, SqlDbType.Binary, -1, "BINARY(MAX)"); } { var varBinary = new _Binary().AsSqlVarBinary(225); VerifySqlType(SqlVersion.Sql13, varBinary, SqlDbType.VarBinary, 225, "VARBINARY(225)"); } { var varBinaryMax = new _Binary().AsSqlVarBinaryMax(); VerifySqlType(SqlVersion.Sql13, varBinaryMax, SqlDbType.VarBinary, -1, "VARBINARY(MAX)"); } { var timestamp = new _Binary().AsSqlTimestamp(); VerifySqlType(SqlVersion.Sql13, timestamp, SqlDbType.Timestamp, "TIMESTAMP"); } { var decimalColumn = new _Decimal().AsSqlDecimal(28, 8); VerifySqlType(SqlVersion.Sql13, decimalColumn, SqlDbType.Decimal, "DECIMAL(28, 8)", 28, 8); } { var smallMoney = new _Decimal().AsSqlSmallMoney(); VerifySqlType(SqlVersion.Sql13, smallMoney, SqlDbType.SmallMoney, "SMALLMONEY"); } { var money = new _Decimal().AsSqlMoney(); VerifySqlType(SqlVersion.Sql13, money, SqlDbType.Money, "MONEY"); } { var date = new _DateTime().AsSqlDate(); VerifySqlType(SqlVersion.Sql13, date, SqlDbType.Date, "DATE"); } { var time = new _DateTime().AsSqlTime(); VerifySqlType(SqlVersion.Sql13, time, SqlDbType.Time, "TIME"); } { var dateTime = new _DateTime().AsSqlDateTime(); VerifySqlType(SqlVersion.Sql13, dateTime, SqlDbType.DateTime, "DATETIME"); } { var smallDateTime = new _DateTime().AsSqlSmallDateTime(); VerifySqlType(SqlVersion.Sql13, smallDateTime, SqlDbType.SmallDateTime, "SMALLDATETIME"); } { var dateTime2 = new _DateTime().AsSqlDateTime2(5); VerifySqlType(SqlVersion.Sql13, dateTime2, SqlDbType.DateTime2, "DATETIME2(5)", 5); } { var charColumn = new _String().AsSqlChar(478); VerifySqlType(SqlVersion.Sql13, charColumn, SqlDbType.Char, 478, "CHAR(478)"); } { var charMax = new _String().AsSqlCharMax(); VerifySqlType(SqlVersion.Sql13, charMax, SqlDbType.Char, -1, "CHAR(MAX)"); } { var nchar = new _String().AsSqlNChar(333); VerifySqlType(SqlVersion.Sql13, nchar, SqlDbType.NChar, 333, "NCHAR(333)"); } { var ncharMax = new _String().AsSqlNCharMax(); VerifySqlType(SqlVersion.Sql13, ncharMax, SqlDbType.NChar, -1, "NCHAR(MAX)"); } { var varchar = new _String().AsSqlVarChar(512); VerifySqlType(SqlVersion.Sql13, varchar, SqlDbType.VarChar, 512, "VARCHAR(512)"); } { var varcharMax = new _String().AsSqlVarCharMax(); VerifySqlType(SqlVersion.Sql13, varcharMax, SqlDbType.VarChar, -1, "VARCHAR(MAX)"); } { var nvarchar = new _String().AsSqlNVarChar(1024); VerifySqlType(SqlVersion.Sql13, nvarchar, SqlDbType.NVarChar, 1024, "NVARCHAR(1024)"); } { var nvarcharMax = new _String().AsSqlNVarCharMax(); VerifySqlType(SqlVersion.Sql13, nvarcharMax, SqlDbType.NVarChar, -1, "NVARCHAR(MAX)"); } { var singleChar = new _Char().AsSqlChar(true); VerifySqlType(SqlVersion.Sql13, singleChar, SqlDbType.NChar, 1, "NCHAR(1)"); singleChar = new _Char().AsSqlChar(false); VerifySqlType(SqlVersion.Sql13, singleChar, SqlDbType.Char, 1, "CHAR(1)"); } }
/// <summary> /// Specifies MySQL DECIMAL(19,4) data type for column. /// </summary> /// <param name="column">The column.</param> /// <returns>This column for fluent coding.</returns> public static _Decimal AsMySqlMoney(this _Decimal column) { return(column.AsMySqlDecimal(19, 4)); }