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

◆ MaxLength

int System.Data.DataColumn.MaxLength
getset

Definition at line 723 of file DataColumn.cs.

724 {
725 get
726 {
727 return _maxLength;
728 }
729 set
730 {
731 long scopeId = DataCommonEventSource.Log.EnterScope("<ds.DataColumn.set_MaxLength|API> {0}, {1}", ObjectID, value);
732 try
733 {
734 if (_maxLength != value)
735 {
736 if (ColumnMapping == MappingType.SimpleContent)
737 {
738 throw ExceptionBuilder.CannotSetMaxLength2(this);
739 }
740 if (DataType != typeof(string) && DataType != typeof(SqlString))
741 {
742 throw ExceptionBuilder.HasToBeStringType(this);
743 }
744 int maxLength = _maxLength;
745 _maxLength = Math.Max(value, -1);
746 if ((maxLength < 0 || value < maxLength) && _table != null && _table.EnforceConstraints && !CheckMaxLength())
747 {
748 _maxLength = maxLength;
749 throw ExceptionBuilder.CannotSetMaxLength(this, value);
750 }
752 }
753 }
754 finally
755 {
756 DataCommonEventSource.Log.ExitScope(scopeId);
757 }
758 }
759 }
virtual MappingType ColumnMapping

Referenced by System.Data.DataColumn.Clone(), System.Data.DataTableReader.GetSchemaTableFromDataTable(), and System.Data.DataColumn.IsMaxLengthViolated().