Hi,
Code:
public static List<Article> GetArticles(int categoryID)
{
if ( categoryID <= 0 )
return GetArticles();
...
}
DLLâs GetArticles() method relies on primary key ( CategoryID ) of Category DB table always having a value equal or greater than 1. But as far as I know, primary keys could also be configured to accept zero as their value?!
a) So isnât GetArticles() flawed, since DB programmer (assuming DLL programmer wonât also create DAL layer and DB tables ) could in the future configure primary key of Category table to also accept value zero? In that case, GetArticles() will never return an article with ID = 0
b) Is there a situation, where categoryID parameter could receive a value smaller than zero? In not, then we could also write:
Code:
public static List<Article> GetArticles(int categoryID)
{
if ( categoryID == 0)
return GetArticles();
...
}
thanx