public void DeleteByExpressionNode_TestMethod() { int mzRegId = 12963; Expression <Func <OulInvoiceRegDto, bool> > query = (x => x.MzRegId == mzRegId); Serialize.Linq.Nodes.ExpressionNode expressionNode = query.ToExpressionNode(); var getByIdRequest = BuildRequest("Delete", new object[] { expressionNode }); var getByIdResponse = ServiceWrapper.ProcessRequest(getByIdRequest); Assert.True(getByIdResponse.Status == ResponseStatus.OK); }
public void GetByExpressionNode_TestMethod() { int mzRegId = 12963; Expression <Func <OulInvoiceRegDto, bool> > query = (x => x.MzRegId == mzRegId); Serialize.Linq.Nodes.ExpressionNode expressionNode = query.ToExpressionNode(); var getByIdRequest = BuildRequest("Get", new object[] { expressionNode }); var getByIdResponse = ServiceWrapper.ProcessRequest(getByIdRequest); Assert.True(getByIdResponse.Status == ResponseStatus.OK); if (getByIdResponse.Result != null) { IList <OulInvoiceRegDto> dtos = getByIdResponse.Result as IList <OulInvoiceRegDto>; Assert.NotNull(dtos); } }
/// <summary> /// Converts to a boolean expression. /// </summary> /// <typeparam name="TEntity">The type of the entity.</typeparam> /// <param name="expressionNode">The expression node.</param> /// <param name="context">The context.</param> /// <returns></returns> private static Expression <Func <TEntity, bool> > ConvertToBooleanExpression <TEntity>(ExpressionNode expressionNode, IExpressionContext context) { return(ConvertToExpression <Func <TEntity, bool> >(expressionNode, context)); }
/// <summary> /// Converts to an expression. /// </summary> /// <typeparam name="TDelegate">The type of the delegate.</typeparam> /// <param name="expressionNode">The expression node.</param> /// <param name="context">The context.</param> /// <returns></returns> private static Expression <TDelegate> ConvertToExpression <TDelegate>(ExpressionNode expressionNode, IExpressionContext context) { var expression = expressionNode.ToExpression(context); return((Expression <TDelegate>)expression); }
protected override void Initialize(UnaryExpression expression) { this.Operand = this.Factory.Create(expression.Operand); }
/// <summary> /// Initializes the specified expression. /// </summary> /// <param name="expression">The expression.</param> protected override void Initialize(ConditionalExpression expression) { this.Test = this.Factory.Create(expression.Test); this.IfTrue = this.Factory.Create(expression.IfTrue); this.IfFalse = this.Factory.Create(expression.IfFalse); }
protected override void Initialize(IndexExpression expression) { Arguments = new ExpressionNodeList(Factory, expression.Arguments); Indexer = new PropertyInfoNode(Factory, expression.Indexer); Object = Factory.Create(expression.Object); }
protected override void Initialize(ListInitExpression expression) { this.Initializers = new ElementInitNodeList(this.Factory, expression.Initializers); this.NewExpression = this.Factory.Create(expression.NewExpression); }