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

◆ Unique

bool System.Data.DataColumn.Unique
getset

Definition at line 875 of file DataColumn.cs.

876 {
877 get
878 {
879 return _unique;
880 }
881 set
882 {
883 long scopeId = DataCommonEventSource.Log.EnterScope("<ds.DataColumn.set_Unique|API> {0}, {1}", ObjectID, value);
884 try
885 {
886 if (_unique == value)
887 {
888 return;
889 }
890 if (value && _expression != null)
891 {
892 throw ExceptionBuilder.UniqueAndExpression();
893 }
894 UniqueConstraint constraint = null;
895 if (_table != null)
896 {
897 if (value)
898 {
899 CheckUnique();
900 }
901 else
902 {
904 while (enumerator.MoveNext())
905 {
906 if (enumerator.Current is UniqueConstraint uniqueConstraint && uniqueConstraint.ColumnsReference.Length == 1 && uniqueConstraint.ColumnsReference[0] == this)
907 {
908 constraint = uniqueConstraint;
909 }
910 }
912 }
913 }
914 _unique = value;
915 if (_table != null)
916 {
917 if (value)
918 {
919 UniqueConstraint constraint2 = new UniqueConstraint(this);
921 }
922 else
923 {
924 _table.Constraints.Remove(constraint);
925 }
926 }
927 }
928 finally
929 {
930 DataCommonEventSource.Log.ExitScope(scopeId);
931 }
932 }
933 }
bool CanRemove(Constraint constraint)
void Remove(Constraint constraint)
void Add(Constraint constraint)
DataExpression _expression
Definition DataColumn.cs:40
ConstraintCollection Constraints
Definition DataTable.cs:332

Referenced by System.Data.DataTableReader.GetSchemaTableFromDataTable(), System.Data.DataColumn.SetOrdinalInternal(), and System.Data.DataColumn.SetTable().