.NET Expressions

API v2 uses LINQ expression parser that use syntax that is very close to standard .NET syntax. There are some difference:

  • Casts are supported via Assignable.As<UserStory>. You can access any simple or reference field of a specific type, like: Assignable.As<UserStory>.Epic.Name. Collections on casted entities are not supported!
  • You can use Convert class to convert strings to numbers or dates or vice versa.
  • Decimal values are converted to double(nullable double) automaticaly in case double and decimal values are used in one expression: result of it.Double + it.Decimal and it.NullableDouble * it.Decimal will be double and double?. You don't need to use Convert.ToDouble(it.Decimal). This also works for IFNONE/IIF operators: you can simply write IFNONE(it.NullableDouble, it.NullableDecimal) or IIF(it.NullableDecimal.HasValue, it.NullableDecimal.Value, it.Double).
  • Nullable bool is automaticaly converted to bool (false for null value). So if nullable bool is used in place where bool should be used it's usage will be converted from it.NullableBool to it.NullableBool == True.
  • Constructors are not supported, but you can construct your anonymous objects using syntax described above: {ex1,ex2}
  • You can use static methods of some types (DateTime, Convert, Guid). E.g. DateTime.Today, Convert.ToInt
  • You can use Nullable types and checks for nulls
  • You can use instance methods of simple types (e.g., object.ToString(), string.Length)
  • You can use IIF operator instead of a?b:c
  • You can use IFNONE operator: IFNONE(a,0) instead of a.HasValue?a.Value:0
  • You can use operators (-,+,*,/), comparisons (<,>,<=,>=,==), Boolean constants (true,false), string constants ("Some string"), chars ('c') and null identifier.
  • Do not forget that + sign is treated as space in URLs so do not forget to replace it with %2b.
  • You can use operator in (id in [1,2,3])

Also some limited subset of IQueryable methods are supported for nested collections (e.g. bugs of user story):

  • Select(selector) - projection as described above
  • Where(filter) - filters as described below
  • Sum(expression) (as well as Max, Min, Average) - aggregations over specified expression
  • Count(filter) - count of filtered items