Exemplo n.º 1
0
 /// <summary>
 /// creates an expression numeric operand
 /// </summary>
 /// <param name="text">text</param>
 /// <param name="cast">cast, None if doesnt apply</param>
 public NumberOperand(string text, DbColumnType cast)
     : base(text, cast)
 {
     if ((valueType = text.ToNumberType()) == null)
     {
         throw new ArgumentException($"Invalid number operand: {text}");
     }
     if (cast != DbColumnType.None && !cast.IsNumeric())
     {
         throw new ArgumentException($"Invalid numeric cast: {cast}");
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// creates an expression column operand
 /// </summary>
 /// <param name="column">column</param>
 /// <param name="cast">cast, None if doesnt apply</param>
 public ColumnOperand(Column column, DbColumnType cast = DbColumnType.None)
     : base(column == null ? String.Empty : column.Identifier(), cast)
 {
     if ((Column = column) == null)
     {
         throw new ArgumentException($"Column operand null or empty");
     }
     Type = Enum.Parse <DbColumnType>(Column.Meta.Type);
     if (cast != DbColumnType.None)
     {
         if ((Type.IsNumeric() && !cast.IsNumeric()))
         {
             throw new ArgumentException($"cast types: {Type} and {cast} doesnot match");
         }
     }
 }