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

◆ Expression

string System.Data.DataColumn.Expression
getset

Definition at line 586 of file DataColumn.cs.

587 {
588 get
589 {
590 if (_expression != null)
591 {
592 return _expression.Expression;
593 }
594 return "";
595 }
596 [RequiresUnreferencedCode("Members from types used in the expressions may be trimmed if not referenced directly.")]
598 set
599 {
600 long scopeId = DataCommonEventSource.Log.EnterScope("<ds.DataColumn.set_Expression|API> {0}, '{1}'", ObjectID, value);
601 if (value == null)
602 {
603 value = string.Empty;
604 }
605 try
606 {
608 if (value.Length > 0)
609 {
611 if (dataExpression2.HasValue)
612 {
614 }
615 }
616 if (_expression == null && dataExpression != null)
617 {
618 if (AutoIncrement || Unique)
619 {
620 throw ExceptionBuilder.ExpressionAndUnique();
621 }
622 if (_table != null)
623 {
624 for (int i = 0; i < _table.Constraints.Count; i++)
625 {
626 if (_table.Constraints[i].ContainsColumn(this))
627 {
628 throw ExceptionBuilder.ExpressionAndConstraint(this, _table.Constraints[i]);
629 }
630 }
631 }
632 bool readOnly = ReadOnly;
633 try
634 {
635 ReadOnly = true;
636 }
637 catch (ReadOnlyException e)
638 {
639 ExceptionBuilder.TraceExceptionForCapture(e);
641 throw ExceptionBuilder.ExpressionAndReadOnly();
642 }
643 }
644 if (_table != null)
645 {
646 if (dataExpression != null && dataExpression.DependsOn(this))
647 {
648 throw ExceptionBuilder.ExpressionCircular();
649 }
653 try
654 {
655 if (dataExpression == null)
656 {
657 for (int j = 0; j < _table.RecordCapacity; j++)
658 {
660 }
661 }
662 else
663 {
665 }
668 return;
669 }
670 catch (Exception e2) when (ADP.IsCatchableExceptionType(e2))
671 {
672 ExceptionBuilder.TraceExceptionForCapture(e2);
673 try
674 {
677 if (expression == null)
678 {
679 for (int k = 0; k < _table.RecordCapacity; k++)
680 {
682 }
683 }
684 else
685 {
687 }
690 }
691 catch (Exception e3) when (ADP.IsCatchableExceptionType(e3))
692 {
693 ExceptionBuilder.TraceExceptionWithoutRethrow(e3);
694 }
695 throw;
696 }
697 }
699 }
700 finally
701 {
702 DataCommonEventSource.Log.ExitScope(scopeId);
703 }
704 }
705 }
static bool IsCatchableExceptionType(Exception e)
Definition ADP.cs:790
void InitializeRecord(int record)
DataExpression _expression
Definition DataColumn.cs:40
DataExpression? DataExpression
void HandleDependentColumnList(DataExpression oldExpression, DataExpression newExpression)
void EvaluateDependentExpressions(DataColumn column)
ConstraintCollection Constraints
Definition DataTable.cs:332
void ResetInternalIndexes(DataColumn column)

Referenced by System.Data.DataColumn.DataColumn(), System.Data.DataColumn.CopyExpressionFrom(), System.Data.Common.DataColumnMapping.GetDataColumnBySchemaAction(), System.Data.DataTableReader.GetSchemaTableFromDataTable(), and System.Data.DataColumn.ToString().