I have a task to upload some data and update information for products.
So i have a code like this:
IEnumerable<DataRow> q = from p in _odbcConnector.readData(strSql.ToString()).Tables[0].AsEnumerable() select p ;
q.ToList().ForEach(p => UpdateProductInfo(Convert.ToInt32(p.ItemArray[0])));
After this i have a method to update product info like
public void UpdateProductInfo(int msgId)
{
var product = _productService.GetProductBySku(row.ItemArray[0].ToString());
if(product != null)
{
something....
}
}
Question: I want to do it in a one transaction scope. So Update or not full list of products.
So question is how to do it in a nope?