根据下面的伪代码,您能否告诉我是否可以这样做,或者在约束失败的情况下重新加载我的数据集会更好?
谢谢!
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();