コード例 #1
0
ファイル: ConvertHelper.cs プロジェクト: zhouweiaccp/sones
        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);
        }
コード例 #2
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;
        }
コード例 #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);
        }
コード例 #4
0
 public static RequestGetVertices MakeRequestGetVertices(ServiceBaseExpression myExpression)
 {
     return(new RequestGetVertices(ServiceExpressionConverter.ConvertExpression(myExpression)));
 }
コード例 #5
0
ファイル: GraphDS_API.cs プロジェクト: alrehamy/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());
        }
コード例 #6
0
ファイル: ServiceRequestFactory.cs プロジェクト: cosh/sones
 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();
 }