Basé sur le pseudo-code ci-dessous pourriez-vous me dire si je peux faire quelque chose comme ceci ou il vaudra mieux recharger mon jeu de données en cas d'échec de la contrainte?ConstraintException après EnforceConstraints dans les jeux de données C#
Merci!
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();