I'm using Linq-to-SQL as my ORM on a ASP.Net MVC2 application. I have a table called Area which is related to the Jefe table.
In my application, I don't want users to write down a value in the IDJefe field, but rather select from a combobox.
Should I ask if string.NullorEmpty for (IDJefe) or (Jefe)? Both of these properties are available to me, but this is my first adventure into building a full application with Linq-to-SQL.
I was thinking of using IDJefe as the value to check, because a comboBox can have a selectedIndex, right?
Thank you.
public IEnumerable<RuleViolation> GetRuleViolations()
{
if (String.IsNullOrEmpty(Nombre))
yield return new RuleViolation("Nombre requerido", "Nombre");
if (IDJefe == null)
yield return new RuleViolation("Jefe requerido", "IDJefe");
yield break;
}