0
基於下面的僞代碼,請告訴我是否可以這樣做,或者在約束失敗的情況下重新加載我的數據集會更好?C#數據集中的EnforceConstraints之後的ConstraintException
謝謝!
var myDataSet = new DataTypedDataset(); // the dataset has some tables with ParentChild and ForeightKey relationships
try{
myDataset.EnforceConstraints = false;
LoadDataset(meDataset); // some method that fills the schema by data that violates given schema constraints
myDataset.EnforceConstraints = true;
}
catch(ConstraintException ce){
LogConstraintException(ce);//some logging
myDataset.EnforceConstraints = false;
}
// suppose I have A = {1}, B = { {A=2, 2}, {A=1,2}}
try{
var aRow = myDataset.TableB.First().ARow;
}
catch(??/*What type of the exception will be here?*/ exception)
{
// hm... pitty
letsPlayFailureTollerantScenario(myDataset.TableB.First(), myDataset.TableA);
}
var rows = myDataset.TableA.GetBRows();