public ComparisonClause(Expression <Func <T, object> > expression) { BinaryExpression binaryExp = SqlBuilderHelper.ConvertToBinaryExpression(expression); Initialize( SqlBuilderHelper.MapExpressionTypeToBinaryOperation(binaryExp.NodeType), typeof(T).Name, SqlBuilderHelper.GetMemberNameFromExpression(binaryExp.Left), SqlBuilderHelper.GetRightValueFromBinaryExpression(binaryExp) ); }
private Dictionary <string, object> GetFieldsToUpsertFromExpression <T>(IEnumerable <Expression <Func <T, object> > > fieldValues) { if (fieldValues == null || !fieldValues.Any()) { throw new ArgumentNullException(nameof(fieldValues)); } Dictionary <string, object> propsToInsert = new Dictionary <string, object>(); foreach (Expression <Func <T, object> > item in fieldValues) { BinaryExpression binaryExp = SqlBuilderHelper.ConvertToBinaryExpression(item); string fieldName = SqlBuilderHelper.GetMemberNameFromExpression(binaryExp.Left); object value = SqlBuilderHelper.GetRightValueFromBinaryExpression(binaryExp); propsToInsert.Add(fieldName, value); } return(propsToInsert); }