コード例 #1
0
 protected long GetIdNullSafe(EntidadeDeBanco value)
 {
     if (value == null)
     {
         return(0);
     }
     return(value.Id);
 }
コード例 #2
0
 protected long GetIdNullSafe(EntidadeDeBanco value, string classeFilha, string classePai)
 {
     if (value == null)
     {
         throw new Exception($"Todo {classeFilha} deve estar associado a um {classePai}!");
     }
     return(value.Id);
 }