Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ConvertToSqlMoney()

static SqlMoney System.Data.Common.SqlConvert.ConvertToSqlMoney ( object value)
inlinestatic

Definition at line 170 of file SqlConvert.cs.

171 {
172 if (value == DBNull.Value)
173 {
174 return SqlMoney.Null;
175 }
176 Type type = value.GetType();
177 return DataStorage.GetStorageType(type) switch
178 {
180 StorageType.Decimal => (decimal)value,
182 StorageType.Int64 => (long)value,
183 StorageType.UInt64 => (ulong)value,
184 StorageType.SqlInt16 => (SqlInt16)value,
186 StorageType.UInt16 => (ushort)value,
188 StorageType.Int32 => (int)value,
189 StorageType.UInt32 => (uint)value,
190 StorageType.SqlByte => (SqlByte)value,
191 StorageType.Byte => (byte)value,
192 _ => throw ExceptionBuilder.ConvertFailed(type, typeof(SqlMoney)),
193 };
194 }
static readonly SqlMoney Null
Definition SqlMoney.cs:17

References System.Data.ExceptionBuilder.ConvertFailed(), System.Xml.Dictionary, System.Data.Common.DataStorage.GetStorageType(), System.Type.GetType(), System.Data.SqlTypes.SqlMoney.Null, System.Data.Common.SqlInt32, System.Data.Common.SqlInt64, System.Data.Common.SqlMoney, System.type, System.DBNull.Value, and System.value.

Referenced by System.Data.BinaryNode.BinaryCompare(), System.Data.Common.SqlConvert.ChangeType2(), System.Data.Common.SqlMoneyStorage.ConvertValue(), System.Data.BinaryNode.EvalBinaryOp(), and System.Data.Common.SqlMoneyStorage.Set().