dotConnect for Snowflake Documentation
On this page
    LINQ to Entities
    On this page

    Besides the standard LINQ operators, dotConnect for Snowflake translates the following .NET members to Snowflake SQL:

    The EF.Functions property provides the following Snowflake-specific methods (the SnowflakeDbFunctionsExtensions class). They can be used only in LINQ to Entities queries; a direct call throws InvalidOperationException.

    Method

    SQL

    bool ILike(string matchExpression, string pattern)Case-insensitive LIKE: matchExpression ILIKE pattern.
    int DateDiffYear(DateTime startDate, DateTime endDate)
    int DateDiffMonth(DateTime startDate, DateTime endDate)
    int DateDiffDay(DateTime startDate, DateTime endDate)
    DATEDIFF(year | month | day, startDate, endDate): the number of year, month, or day boundaries between the dates.
    long DateDiffHour(DateTime startDate, DateTime endDate)
    long DateDiffMinute(DateTime startDate, DateTime endDate)
    long DateDiffSecond(DateTime startDate, DateTime endDate)
    DATEDIFF(hour | minute | second, startDate, endDate): the number of hour, minute, or second boundaries between the values.
    var start = new DateTime(2024, 1, 1);
    var orders = context.Orders
      .Where(o => EF.Functions.ILike(o.CustomerName, "%smith%"))
      .Select(o => new { o.Id, Days = EF.Functions.DateDiffDay(start, o.OrderDate) })
      .ToList();
    

    The following query constructs aren't supported: