applied c# changes from sql