示例#1
0
        internal static ServiceBaseExpression ToServiceExpression(IExpression myExpression)
        {
            ServiceBaseExpression expression = null;

            if (myExpression is BinaryExpression)
            {
                expression = new ServiceBinaryExpression((BinaryExpression)myExpression);
            }
            else if (myExpression is PropertyExpression)
            {
                expression = new ServicePropertyExpression((PropertyExpression)myExpression);
            }
            else if (myExpression is SingleLiteralExpression)
            {
                expression = new ServiceSingleLiteralExpression((SingleLiteralExpression)myExpression);
            }
            else if (myExpression is CollectionLiteralExpression)
            {
                expression = new ServiceCollectionLiteralExpression((CollectionLiteralExpression)myExpression);
            }
            else if (myExpression is RangeLiteralExpression)
            {
                expression = new ServiceRangeLiteralExpression((RangeLiteralExpression)myExpression);
            }
            else if (myExpression is UnaryExpression)
            {
                expression = new ServiceUnaryExpression((UnaryExpression)myExpression);
            }
            return(expression);
        }
        public static IExpression ConvertExpression(ServiceBaseExpression myExpression)
        {
            IExpression ResultExpression = null;

            if (myExpression is ServiceBinaryExpression)
            {
                var Expression = myExpression as ServiceBinaryExpression;
                var Left = ServiceExpressionConverter.ConvertExpression(Expression.Left);
                var Right = ServiceExpressionConverter.ConvertExpression(Expression.Right);
                var Operator = (BinaryOperator)Expression.Operator;
                return new BinaryExpression(Left, Operator, Right);
            }
            else if (myExpression is
                ServicePropertyExpression)
            {
                var Expression = myExpression as ServicePropertyExpression;
                return new PropertyExpression(Expression.NameOfVertexType, Expression.NameOfProperty, Expression.Edition);
            }
            else if (myExpression is
                ServiceSingleLiteralExpression)
            {
                var Expression = myExpression as ServiceSingleLiteralExpression;
                return new SingleLiteralExpression((IComparable)Expression.Constant);
            }
            else if (myExpression is
                ServiceCollectionLiteralExpression)
            {
                var Expression = myExpression as ServiceCollectionLiteralExpression;
                return new CollectionLiteralExpression(Expression.CollectionLiteral.Select(
                    x => (IComparable)x).ToList());
            }
            else if (myExpression is
                ServiceRangeLiteralExpression)
            {
                var Expression = myExpression as ServiceRangeLiteralExpression;
                return new RangeLiteralExpression((IComparable)Expression.Lower, (IComparable)Expression.Upper,
                    Expression.IncludeBorders);
            }
            else if (myExpression is ServiceUnaryExpression)
            {
                var Expression = myExpression as ServiceUnaryExpression;
                return new UnaryExpression((UnaryLogicOperator)Expression.Operator,
                    ServiceExpressionConverter.ConvertExpression(Expression.Expression));
            }

            return ResultExpression;
        }
示例#3
0
        public static IExpression ConvertExpression(ServiceBaseExpression myExpression)
        {
            IExpression ResultExpression = null;

            if (myExpression is ServiceBinaryExpression)
            {
                var Expression = myExpression as ServiceBinaryExpression;
                var Left       = ServiceExpressionConverter.ConvertExpression(Expression.Left);
                var Right      = ServiceExpressionConverter.ConvertExpression(Expression.Right);
                var Operator   = (BinaryOperator)Expression.Operator;
                return(new BinaryExpression(Left, Operator, Right));
            }
            else if (myExpression is
                     ServicePropertyExpression)
            {
                var Expression = myExpression as ServicePropertyExpression;
                return(new PropertyExpression(Expression.NameOfVertexType, Expression.NameOfProperty, Expression.Edition));
            }
            else if (myExpression is
                     ServiceSingleLiteralExpression)
            {
                var Expression = myExpression as ServiceSingleLiteralExpression;
                return(new SingleLiteralExpression((IComparable)Expression.Constant));
            }
            else if (myExpression is
                     ServiceCollectionLiteralExpression)
            {
                var Expression = myExpression as ServiceCollectionLiteralExpression;
                return(new CollectionLiteralExpression(Expression.CollectionLiteral.Select(
                                                           x => (IComparable)x).ToList()));
            }
            else if (myExpression is
                     ServiceRangeLiteralExpression)
            {
                var Expression = myExpression as ServiceRangeLiteralExpression;
                return(new RangeLiteralExpression((IComparable)Expression.Lower, (IComparable)Expression.Upper,
                                                  Expression.IncludeBorders));
            }
            else if (myExpression is ServiceUnaryExpression)
            {
                var Expression = myExpression as ServiceUnaryExpression;
                return(new UnaryExpression((UnaryLogicOperator)Expression.Operator,
                                           ServiceExpressionConverter.ConvertExpression(Expression.Expression)));
            }

            return(ResultExpression);
        }
 public static RequestGetVertices MakeRequestGetVertices(ServiceBaseExpression myExpression)
 {
     return(new RequestGetVertices(ServiceExpressionConverter.ConvertExpression(myExpression)));
 }
示例#5
0
        public List <ServiceVertexInstance> GetVertices(SecurityToken mySecurityToken, long myTransactionToken, ServiceBaseExpression myExpression)
        {
            var Request  = ServiceRequestFactory.MakeRequestGetVertices(myExpression);
            var Response = this.GraphDS.GetVertices <IEnumerable <IVertex> >(mySecurityToken, myTransactionToken, Request,
                                                                             ServiceReturnConverter.ConvertOnlyVertices);

            return(Response.Select(x => new ServiceVertexInstance(x)).ToList());
        }
示例#6
0
 public static RequestGetVertices MakeRequestGetVertices(ServiceBaseExpression myExpression)
 {
     return new RequestGetVertices(ServiceExpressionConverter.ConvertExpression(myExpression));
 }
示例#7
0
文件: GraphDS_API.cs 项目: cosh/sones
 public List<ServiceVertexInstance> GetVertices(SecurityToken mySecurityToken, long myTransactionToken, ServiceBaseExpression myExpression)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertices(myExpression);
     var Response = this.GraphDS.GetVertices<IEnumerable<IVertex>>(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConvertOnlyVertices);
     return Response.Select(x => new ServiceVertexInstance(x)).ToList();
 }