Some experienced note of bugs

1. One exception can cause a nother DB blocking issue,

when use NH, if below code:

NHibernateProvider.Save(new class());
string str = string.empty.
srt = str.SubString(2);
NHibernateProvider.Commit();
A out of range exception will be threw after the transaction began ( if you already begin the transaction in the session begin ) but before the commit, so the transaction will never be end, and it hanges up and unfortunately it block others.
2. if you use QA connectionstring on PROD, it is definately an error.
3. coding standard, especially you are handling a loop.
liek:
foreach(i=0;i<count;i++)
{
if(condition)
{
if(i == number -1)
{
indicator = true;
}
}
}
if (indicator)
{}
actually, the indicator should be true once one of the condition is true, in above loop you may miss the change to update the indicator's value, if in a turn that when i == number -1 the condition is false.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章