public static Expression <Func <TAzureEntity, bool> > Transfer(Expression <Func <TEntity, bool> > filter)
        {
            var oldParam = filter.Parameters.FirstOrDefault(p => p.Type == typeof(TEntity));

            if (oldParam == null || filter.Parameters.Except(new[] { oldParam }).Any())
            {
                throw new InvalidOperationException("lambda is not in correct format");
            }

            var newParam = Expression.Parameter(typeof(TAzureEntity));

            var result = new AzureTransferExpression <TAzureEntity, TEntity>(newParam, oldParam).Visit(filter.Body);

            return(Expression.Lambda <Func <TAzureEntity, bool> >(result, newParam));
        }
Example #2
0
 public static Expression <Func <TAzureEntity, bool> > ToAzureFilter <TAzureEntity, TEntity>(Expression <Func <TEntity, bool> > filter)
     where TAzureEntity : TableServiceEntity
     where TEntity : Entity
 {
     return(AzureTransferExpression <TAzureEntity, TEntity> .Transfer(filter));
 }