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

◆ DefaultValue

object System.Data.DataColumn.DefaultValue
getset

Definition at line 528 of file DataColumn.cs.

529 {
530 get
531 {
533 {
534 if (_storage != null)
535 {
537 }
538 else if (_isSqlType)
539 {
541 }
542 else if (_implementsINullable)
543 {
544 PropertyInfo property = _dataType.GetProperty("Null", BindingFlags.Static | BindingFlags.Public);
545 if (property != null)
546 {
547 _defaultValue = property.GetValue(null, null);
548 }
549 }
550 }
551 return _defaultValue;
552 }
554 set
555 {
556 DataCommonEventSource.Log.Trace("<ds.DataColumn.set_DefaultValue|API> {0}", ObjectID);
557 if (_defaultValue != null && DefaultValue.Equals(value))
558 {
559 return;
560 }
561 if (AutoIncrement)
562 {
563 throw ExceptionBuilder.DefaultValueAndAutoIncrement();
564 }
565 object obj = ((value == null) ? DBNull.Value : value);
566 if (obj != DBNull.Value && DataType != typeof(object))
567 {
568 try
569 {
571 }
572 catch (InvalidCastException inner)
573 {
574 throw ExceptionBuilder.DefaultValueColumnDataType(ColumnName, obj.GetType(), DataType, inner);
575 }
576 }
579 }
580 }
static bool IsObjectSqlNull(object value)
static object ChangeTypeForDefaultValue(object value, Type type, IFormatProvider formatProvider)
PropertyInfo? GetProperty(string name)
Definition Type.cs:815

Referenced by System.Data.ForeignKeyConstraint.CascadeDelete(), System.Data.ForeignKeyConstraint.CascadeUpdate(), System.Data.DataTableReader.GetSchemaTableFromDataTable(), and System.Data.DataColumn.InitializeRecord().