>>In the database the column is smallint and defined as short in the class definition.
>
>So why is the Convert.ToInt16 needed?
I think it's not needed, I'll remove it. In my original code it was needed as the result was anonymous type.
So, the code now is reduced to
var lastLocSuffix = _salespointAdapter.GetAll().Max(sp=>sp.LocSuffix);
Int16 newSuffix = 1;
if (lastLocSuffix != null)
{
newSuffix = lastLocSuffix++;
}
salespoint.LocSuffix = newSuffix;
If it's not broken, fix it until it is.
My Blog