Can someone suggest the best exception handling mechanism in LINQ? Suppose I have the following function:
public List<test_dataRange> GetDataRange()
{
testDataContext = new ParentDataContext(conn);
List< test_dataRange > dataRange = (from pp in testDataContext. test_dataRanges
select pp).ToList();
return dataRange;
}
What are the best exception handling mechanisms in LINQ that can be applied here? Also What are the best exception handling mechanisms for those functions with Transaction, For eg:
public void UpdateQAProperty(Data_QAProperty qaProperty)
{
parentDataContext = new ParentDataContext(conn);
DbTransaction dbTransaction = null;
parentDataContext.Connection.Open();
dbTransaction = masterDataContext.Connection.BeginTransaction();
parentDataContext.Transaction = dbTransaction;
var property = (from y in parentDataContext. QAProperties
where y.Id == qaProperty.Id
select y).FirstOrDefault();
property.Height = qaProperty.Height;
property.Caption = qaProperty.Caption;
property.Width = qaProperty.Width;
property.Length= qaProperty.Length;
parentDataContext.SubmitChanges();
dbTransaction.Commit();
}