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

◆ DataType

Type System.Data.DataColumn.DataType
getset

Definition at line 376 of file DataColumn.cs.

377 {
378 get
379 {
380 return _dataType;
381 }
383 set
384 {
385 if (!(_dataType != value))
386 {
387 return;
388 }
389 if (HasData)
390 {
391 throw ExceptionBuilder.CantChangeDataType();
392 }
393 if (value == null)
394 {
395 throw ExceptionBuilder.NullDataType();
396 }
399 {
400 throw ExceptionBuilder.ColumnTypeNotSupported();
401 }
402 if (_table != null && IsInRelation())
403 {
404 throw ExceptionBuilder.ColumnsTypeMismatch();
405 }
406 if (storageType == StorageType.BigInteger && _expression != null)
407 {
408 throw ExprException.UnsupportedDataType(value);
409 }
411 {
412 try
413 {
415 {
417 }
418 else if (typeof(BigInteger) == value)
419 {
421 }
422 else if (typeof(string) == value)
423 {
424 _defaultValue = DefaultValue.ToString();
425 }
426 else if (typeof(SqlString) == value)
427 {
429 }
430 else if (typeof(object) != value)
431 {
433 }
434 }
435 catch (InvalidCastException inner)
436 {
437 throw ExceptionBuilder.DefaultValueDataType(ColumnName, DefaultValue.GetType(), value, inner);
438 }
439 catch (FormatException inner2)
440 {
441 throw ExceptionBuilder.DefaultValueDataType(ColumnName, DefaultValue.GetType(), value, inner2);
442 }
443 }
444 if (ColumnMapping == MappingType.SimpleContent && value == typeof(char))
445 {
446 throw ExceptionBuilder.CannotSetSimpleContentType(ColumnName, value);
447 }
449 if (StorageType.String == storageType)
450 {
451 _maxLength = -1;
452 }
454 XmlDataType = null;
455 if (!AutoIncrement)
456 {
457 return;
458 }
460 {
461 AutoIncrement = false;
462 }
463 if (_autoInc != null)
464 {
465 AutoIncrementValue autoInc = _autoInc;
466 _autoInc = null;
467 AutoInc.Auto = autoInc.Auto;
468 AutoInc.Seed = autoInc.Seed;
469 AutoInc.Step = autoInc.Step;
470 if (_autoInc.DataType == autoInc.DataType)
471 {
472 _autoInc.Current = autoInc.Current;
473 }
474 else if (autoInc.DataType == typeof(long))
475 {
476 AutoInc.Current = (BigInteger)(long)autoInc.Current;
477 }
478 else
479 {
480 AutoInc.Current = (long)(BigInteger)autoInc.Current;
481 }
482 }
483 }
484 }
static object ConvertFromBigInteger(BigInteger value, Type type, IFormatProvider formatProvider)
static BigInteger ConvertToBigInteger(object value, IFormatProvider formatProvider)
static bool ImplementsINullableValue(StorageType typeCode, Type dataType)
static StorageType GetStorageType(Type dataType)
static object ChangeTypeForDefaultValue(object value, Type type, IFormatProvider formatProvider)
static SqlString ConvertToSqlString(object value)
AutoIncrementValue _autoInc
Definition DataColumn.cs:78
static bool IsAutoIncrementType(Type dataType)
virtual MappingType ColumnMapping
void UpdateColumnType([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields|DynamicallyAccessedMemberTypes.PublicProperties)] Type type, StorageType typeCode)
DataExpression _expression
Definition DataColumn.cs:40
static SimpleType CreateSimpleType(StorageType typeCode, Type type)

Referenced by System.Data.DataRelation.CheckState(), System.Data.DataColumn.Clone(), System.Data.Common.DataColumnMapping.GetDataColumnBySchemaAction(), System.Data.DataTableReader.GetSchemaTableFromDataTable(), System.Data.ForeignKeyConstraint.NonVirtualCheckState(), and System.Data.DataColumn.SetValue().