Example #1
0
 internal ResourceExpression(Expression source, ExpressionType nodeType, Type type, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection)
     : base(nodeType, type)
 {
     this.expandPaths        = expandPaths ?? new List <string>();
     this.countOption        = countOption;
     this.customQueryOptions = customQueryOptions ?? new Dictionary <ConstantExpression, ConstantExpression>(ReferenceEqualityComparer <ConstantExpression> .Instance);
     this.projection         = projection;
     this.source             = source;
 }
#pragma warning disable 618
        internal ResourceExpression(Expression source, ExpressionType nodeType, Type type, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection)
            : base(nodeType, type)
        {
            this.expandPaths = expandPaths ?? new List<string>();
            this.countOption = countOption;
            this.customQueryOptions = customQueryOptions ?? new Dictionary<ConstantExpression, ConstantExpression>(ReferenceEqualityComparer<ConstantExpression>.Instance);
            this.projection = projection;
            this.Source = source;
        }
        /// <summary>
        /// Creates a NavigationPropertySingletonExpression expression
        /// </summary>
        /// <param name="type">the return type of the expression</param>
        /// <param name="source">the source expression</param>
        /// <param name="memberExpression">property member name</param>
        /// <param name="resourceType">resource type for expression</param>
        /// <param name="expandPaths">expand paths for resource set</param>
        /// <param name="countOption">count option for the resource set</param>
        /// <param name="customQueryOptions">custom query options for resourcse set</param>
        /// <param name="projection">projection expression</param>
        internal NavigationPropertySingletonExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection)
            : base(source, (ExpressionType)ResourceExpressionType.ResourceNavigationPropertySingleton, type, expandPaths, countOption, customQueryOptions, projection)
        {
            Debug.Assert(memberExpression != null, "memberExpression != null");
            Debug.Assert(resourceType != null, "resourceType != null");

            this.memberExpression = memberExpression;
            this.resourceType = resourceType;
        }
Example #4
0
        /// <summary>
        /// Count signature on database file.
        /// </summary>
        /// <param name="filePath">Full path to database file.</param>
        /// <param name="option">Database count option.</param>
        /// <returns>Number of signature contained on specified database.</returns>
        public static uint CountSignature(string filePath, CountOption option)
        {
            Contract.Requires <ArgumentNullException>(!string.IsNullOrWhiteSpace(filePath), nameof(filePath));
            Contract.Requires <FileNotFoundException>(File.Exists(filePath), nameof(filePath));

            uint sigs = 0;

            NativeMethods.cl_countsigs(filePath, (uint)option, ref sigs).ThrowIfError();
            return(sigs);
        }
Example #5
0
 /// <summary>
 /// Creates a Resource expression
 /// </summary>
 /// <param name="source">the source expression</param>
 /// <param name="type">the return type of the expression</param>
 /// <param name="expandPaths">the expand paths</param>
 /// <param name="countOption">the count option</param>
 /// <param name="customQueryOptions">The custom query options</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 internal ResourceExpression(Expression source, Type type, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion)
 {
     this.source             = source;
     this.type               = type;
     this.expandPaths        = expandPaths ?? new List <string>();
     this.countOption        = countOption;
     this.customQueryOptions = customQueryOptions ?? new Dictionary <ConstantExpression, ConstantExpression>(ReferenceEqualityComparer <ConstantExpression> .Instance);
     this.projection         = projection;
     this.ResourceTypeAs     = resourceTypeAs;
     this.uriVersion         = uriVersion ?? Util.DataServiceVersion1;
 }
Example #6
0
 /// <summary>
 /// Creates a Resource expression
 /// </summary>
 /// <param name="source">the source expression</param>
 /// <param name="type">the return type of the expression</param>
 /// <param name="expandPaths">the expand paths</param>
 /// <param name="countOption">the count option</param>
 /// <param name="customQueryOptions">The custom query options</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 /// <param name="operationName">name of function</param>
 /// <param name="operationParameters">parameters' names and values of function</param>
 /// <param name="isAction">action flag</param>
 internal ResourceExpression(Expression source, Type type, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string operationName, Dictionary <string, string> operationParameters, bool isAction)
 {
     this.source              = source;
     this.type                = type;
     this.expandPaths         = expandPaths ?? new List <string>();
     this.countOption         = countOption;
     this.customQueryOptions  = customQueryOptions ?? new Dictionary <ConstantExpression, ConstantExpression>(ReferenceEqualityComparer <ConstantExpression> .Instance);
     this.projection          = projection;
     this.ResourceTypeAs      = resourceTypeAs;
     this.uriVersion          = uriVersion ?? Util.ODataVersion4;
     this.operationName       = operationName;
     this.OperationParameters = operationParameters ?? new Dictionary <string, string>(StringComparer.Ordinal);
     this.isAction            = isAction;
 }
        internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection)
            : base(source, source != null ? (ExpressionType)ResourceExpressionType.ResourceNavigationProperty : (ExpressionType)ResourceExpressionType.RootResourceSet, type, expandPaths, countOption, customQueryOptions, projection)
        {
            Debug.Assert(type != null, "type != null");
            Debug.Assert(memberExpression != null, "memberExpression != null");
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(
                (source == null && memberExpression is ConstantExpression) ||
                (source != null && memberExpression is MemberExpression),
                "source is null with constant entity set name, or not null with member expression");

            this.member = memberExpression;
            this.resourceType = resourceType;
            this.sequenceQueryOptions = new List<QueryOptionExpression>();
        }
        /// <summary>
        /// Creates a navigation resource expression
        /// </summary>
        /// <param name="type">the return type of the expression</param>
        /// <param name="source">the source expression</param>
        /// <param name="memberExpression">property member name</param>
        /// <param name="resourceType">the element type of the resource</param>
        /// <param name="expandPaths">expand paths for resource set</param>
        /// <param name="countOption">count query option for the resource</param>
        /// <param name="customQueryOptions">custom query options for resource</param>
        /// <param name="projection">the projection expression</param>
        /// <param name="resourceTypeAs">TypeAs type</param>
        /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
        /// <param name="operationName">name of function</param>
        /// <param name="operationParameters">parameters' names and values of function</param>
        /// <param name="isAction">action flag</param>
        internal QueryableResourceExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string operationName, Dictionary<string, string> operationParameters, bool isAction)
            : base(source, type, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion, operationName, operationParameters, isAction)
        {
            Debug.Assert(type != null, "type != null");
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(
                (source == null && memberExpression is ConstantExpression) ||
                (source != null && memberExpression is MemberExpression) ||
                (memberExpression == null),
                "source is null with constant entity set name, or not null with member expression, or memberExpression is null for function import.");

            this.member = memberExpression;
            this.resourceType = resourceType;
            this.sequenceQueryOptions = new List<QueryOptionExpression>();
            this.keyPredicateConjuncts = new List<Expression>();
        }
        public Object GetValue(Object value, out int?count)
        {
            count = null;
            if (LinkAccessor == null)
            {
                return(value);
            }

            value = LinkAccessor(value);
            if (CountOption.GetValueOrDefault())
            {
                if (value == null)
                {
                    count = 0;
                }
                else if (value is IReadOnlyCollection <Object> )
                {
                    count = (value as IReadOnlyCollection <Object>).Count;
                }
                else if (value is ICollection)
                {
                    count = (value as ICollection).Count;
                }
                else if (value is IEnumerable)
                {
                    var list = new List <Object>();
                    foreach (Object item in value as IEnumerable)
                    {
                        list.Add(item);
                    }
                    count = list.Count;
                    value = list;
                }
                else
                {
                    count = 1;
                }
            }
            return(value);
        }
        /// <summary>
        /// Creates a ResourceSet expression
        /// </summary>
        /// <param name="type">the return type of the expression</param>
        /// <param name="source">the source expression</param>
        /// <param name="memberExpression">property member name</param>
        /// <param name="resourceType">the element type of the resource set</param>
        /// <param name="expandPaths">expand paths for resource set</param>
        /// <param name="countOption">count query option for the resource set</param>
        /// <param name="customQueryOptions">custom query options for resourcse set</param>
        internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection)
            : base(source, source != null ? (ExpressionType)ResourceExpressionType.ResourceNavigationProperty : (ExpressionType)ResourceExpressionType.RootResourceSet, type, expandPaths, countOption, customQueryOptions, projection)
        {
            Debug.Assert(type != null, "type != null");
            Debug.Assert(memberExpression != null, "memberExpression != null");
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(
                (source == null && memberExpression is ConstantExpression) ||
                (source != null && memberExpression is MemberExpression),
                "source is null with constant entity set name, or not null with member expression");

            this.member               = memberExpression;
            this.resourceType         = resourceType;
            this.sequenceQueryOptions = new List <QueryOptionExpression>();
        }
 internal NavigationPropertySingletonExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion) : base(source, type, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion)
 {
     this.memberExpression = memberExpression;
     this.resourceType = resourceType;
 }
Example #12
0
        internal NavigationPropertySingletonExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection)
            : base(source, (ExpressionType)ResourceExpressionType.ResourceNavigationPropertySingleton, type, expandPaths, countOption, customQueryOptions, projection)
        {
            Debug.Assert(memberExpression != null, "memberExpression != null");
            Debug.Assert(resourceType != null, "resourceType != null");

            this.memberExpression = memberExpression;
            this.resourceType     = resourceType;
        }
 /// <summary>
 /// Creates a singleton resource expression
 /// </summary>
 /// <param name="type">the return type of the expression</param>
 /// <param name="source">the source expression</param>
 /// <param name="memberExpression">property member name</param>
 /// <param name="resourceType">the element type of the resource</param>
 /// <param name="expandPaths">expand paths for resource set</param>
 /// <param name="countOption">count query option for the resource</param>
 /// <param name="customQueryOptions">custom query options for resource</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 /// <param name="functionName">name of function</param>
 /// <param name="functionParameters">parameters' names and values of function</param>
 /// <param name="isAction">action flag</param>
 internal SingletonResourceExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string functionName, Dictionary<string, string> functionParameters, bool isAction) :
     base(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion, functionName, functionParameters, isAction)
 {
     UseFilterAsPredicate = true;
 }
 /// <summary>
 /// Creates a resource set expression
 /// </summary>
 /// <param name="type">the return type of the expression</param>
 /// <param name="source">the source expression</param>
 /// <param name="memberExpression">property member name</param>
 /// <param name="resourceType">the element type of the resource</param>
 /// <param name="expandPaths">expand paths for resource set</param>
 /// <param name="countOption">count query option for the resource</param>
 /// <param name="customQueryOptions">custom query options for resource</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 /// <param name="operationName">name of function</param>
 /// <param name="operationParameters">parameters' names and values of function</param>
 /// <param name="operationReturnType">return type of function</param>
 /// <param name="isAction">action flag</param>
 internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string operationName, Dictionary <string, string> operationParameters, Type operationReturnType, bool isAction)
     : base(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion, operationName, operationParameters, operationReturnType, isAction)
 {
 }
        /// <summary>
        /// Creates a navigation resource expression
        /// </summary>
        /// <param name="type">the return type of the expression</param>
        /// <param name="source">the source expression</param>
        /// <param name="memberExpression">property member name</param>
        /// <param name="resourceType">the element type of the resource</param>
        /// <param name="expandPaths">expand paths for resource set</param>
        /// <param name="countOption">count query option for the resource</param>
        /// <param name="customQueryOptions">custom query options for resource</param>
        /// <param name="projection">the projection expression</param>
        /// <param name="resourceTypeAs">TypeAs type</param>
        /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
        /// <param name="operationName">name of function</param>
        /// <param name="operationParameters">parameters' names and values of function</param>
        /// <param name="isAction">action flag</param>
        internal QueryableResourceExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string operationName, Dictionary <string, string> operationParameters, bool isAction)
            : base(source, type, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion, operationName, operationParameters, isAction)
        {
            Debug.Assert(type != null, "type != null");
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(
                (source == null && memberExpression is ConstantExpression) ||
                (source != null && memberExpression is MemberExpression) ||
                (memberExpression == null),
                "source is null with constant entity set name, or not null with member expression, or memberExpression is null for function import.");

            this.member                = memberExpression;
            this.resourceType          = resourceType;
            this.sequenceQueryOptions  = new List <QueryOptionExpression>();
            this.keyPredicateConjuncts = new List <Expression>();
        }
Example #16
0
 /// <summary>
 /// Creates a Resource expression
 /// </summary>
 /// <param name="source">the source expression</param>
 /// <param name="type">the return type of the expression</param>
 /// <param name="expandPaths">the expand paths</param>
 /// <param name="countOption">the count option</param>
 /// <param name="customQueryOptions">The custom query options</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 /// <param name="operationName">name of function</param>
 /// <param name="operationParameters">parameters' names and values of function</param>
 /// <param name="isAction">action flag</param>
 internal ResourceExpression(Expression source, Type type, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string operationName, Dictionary<string, string> operationParameters, bool isAction)
 {
     this.source = source;
     this.type = type;
     this.expandPaths = expandPaths ?? new List<string>();
     this.countOption = countOption;
     this.customQueryOptions = customQueryOptions ?? new Dictionary<ConstantExpression, ConstantExpression>(ReferenceEqualityComparer<ConstantExpression>.Instance);
     this.projection = projection;
     this.ResourceTypeAs = resourceTypeAs;
     this.uriVersion = uriVersion ?? Util.ODataVersion4;
     this.operationName = operationName;
     this.OperationParameters = operationParameters ?? new Dictionary<string, string>(StringComparer.Ordinal);
     this.isAction = isAction;
 }
Example #17
0
 internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection)
     : base(source, (source != null) ? ((ExpressionType)10001) : ((ExpressionType)10000), type, expandPaths, countOption, customQueryOptions, projection)
 {
     member               = memberExpression;
     this.resourceType    = resourceType;
     sequenceQueryOptions = new List <QueryOptionExpression>();
 }
Example #18
0
        /// <summary>
        /// Creates a ResourceSet expression
        /// </summary>
        /// <param name="type">the return type of the expression</param>
        /// <param name="source">the source expression</param>
        /// <param name="memberExpression">property member name</param>
        /// <param name="resourceType">the element type of the resource set</param>
        /// <param name="expandPaths">expand paths for resource set</param>
        /// <param name="countOption">count query option for the resource set</param>
        /// <param name="customQueryOptions">custom query options for resourcse set</param>
        /// <param name="projection">the projection expression</param>
        /// <param name="resourceTypeAs">TypeAs type</param>
        /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
        internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion)
            : base(source, type, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion)
        {
            Debug.Assert(type != null, "type != null");
            Debug.Assert(memberExpression != null, "memberExpression != null");
            Debug.Assert(resourceType != null, "resourceType != null");
            Debug.Assert(
                (source == null && memberExpression is ConstantExpression) ||
                (source != null && memberExpression is MemberExpression),
                "source is null with constant entity set name, or not null with member expression");

            this.member                = memberExpression;
            this.resourceType          = resourceType;
            this.sequenceQueryOptions  = new List <QueryOptionExpression>();
            this.keyPredicateConjuncts = new List <Expression>();
        }
        /// <summary>
        /// Creates a navigation resource expression
        /// </summary>
        /// <param name="expressionType">The expression type.</param>
        /// <param name="type">the return type of the expression</param>
        /// <param name="source">the source expression</param>
        /// <param name="memberExpression">property member name</param>
        /// <param name="resourceType">the element type of the resource</param>
        /// <param name="expandPaths">expand paths for resource set</param>
        /// <param name="countOption">count query option for the resource</param>
        /// <param name="customQueryOptions">custom query options for resource</param>
        /// <param name="projection">the projection expression</param>
        /// <param name="resourceTypeAs">TypeAs type</param>
        /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
        /// <param name="operationName">The operation name.</param>
        /// <param name="operationParameters">The operation parameter names and parameters pair for Resource</param>
        /// <returns>The navigation resource expression.</returns>
        internal static QueryableResourceExpression CreateNavigationResourceExpression(ExpressionType expressionType, Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string operationName, Dictionary<string, string> operationParameters)
        {
            Debug.Assert(
                expressionType == (ExpressionType)ResourceExpressionType.RootResourceSet || expressionType == (ExpressionType)ResourceExpressionType.ResourceNavigationProperty || expressionType == (ExpressionType)ResourceExpressionType.RootSingleResource,
                "Expression type is not one of following: RootResourceSet, ResourceNavigationProperty, RootSingleResource.");

            QueryableResourceExpression expression = null;

            if (expressionType == (ExpressionType)ResourceExpressionType.RootResourceSet || expressionType == (ExpressionType)ResourceExpressionType.ResourceNavigationProperty)
            {
                expression = new ResourceSetExpression(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion);
            }

            if (expressionType == (ExpressionType)ResourceExpressionType.RootSingleResource)
            {
                expression = new SingletonResourceExpression(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion);
            }

            if (expression != null)
            {
                expression.OperationName = operationName;
                expression.OperationParameters = operationParameters;
                return expression;
            }

            return null;
        }
Example #20
0
 internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion) : base(source, type, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion)
 {
     this.member               = memberExpression;
     this.resourceType         = resourceType;
     this.sequenceQueryOptions = new List <QueryOptionExpression>();
 }
        /// <summary>
        /// Creates a navigation resource expression
        /// </summary>
        /// <param name="expressionType">The expression type.</param>
        /// <param name="type">the return type of the expression</param>
        /// <param name="source">the source expression</param>
        /// <param name="memberExpression">property member name</param>
        /// <param name="resourceType">the element type of the resource</param>
        /// <param name="expandPaths">expand paths for resource set</param>
        /// <param name="countOption">count query option for the resource</param>
        /// <param name="customQueryOptions">custom query options for resource</param>
        /// <param name="projection">the projection expression</param>
        /// <param name="resourceTypeAs">TypeAs type</param>
        /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
        /// <param name="operationName">The operation name.</param>
        /// <param name="operationParameters">The operation parameter names and parameters pair for Resource</param>
        /// <returns>The navigation resource expression.</returns>
        internal static QueryableResourceExpression CreateNavigationResourceExpression(ExpressionType expressionType, Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string operationName, Dictionary <string, string> operationParameters)
        {
            Debug.Assert(
                expressionType == (ExpressionType)ResourceExpressionType.RootResourceSet || expressionType == (ExpressionType)ResourceExpressionType.ResourceNavigationProperty || expressionType == (ExpressionType)ResourceExpressionType.RootSingleResource,
                "Expression type is not one of following: RootResourceSet, ResourceNavigationProperty, RootSingleResource.");

            QueryableResourceExpression expression = null;

            if (expressionType == (ExpressionType)ResourceExpressionType.RootResourceSet || expressionType == (ExpressionType)ResourceExpressionType.ResourceNavigationProperty)
            {
                expression = new ResourceSetExpression(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion);
            }

            if (expressionType == (ExpressionType)ResourceExpressionType.RootSingleResource)
            {
                expression = new SingletonResourceExpression(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion);
            }

            if (expression != null)
            {
                expression.OperationName       = operationName;
                expression.OperationParameters = operationParameters;
                return(expression);
            }

            return(null);
        }
 internal NavigationPropertySingletonExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection)
     : base(source, (ExpressionType)10002, type, expandPaths, countOption, customQueryOptions, projection)
 {
     this.memberExpression = memberExpression;
     this.resourceType     = resourceType;
 }
 /// <summary>
 /// Creates a navigation resource expression
 /// </summary>
 /// <param name="type">the return type of the expression</param>
 /// <param name="source">the source expression</param>
 /// <param name="memberExpression">property member name</param>
 /// <param name="resourceType">the element type of the resource</param>
 /// <param name="expandPaths">expand paths for resource set</param>
 /// <param name="countOption">count query option for the resource</param>
 /// <param name="customQueryOptions">custom query options for resource</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 internal QueryableResourceExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion)
     : this(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion, null, null, false)
 {
 }
 /// <summary>
 /// Creates a resource set expression
 /// </summary>
 /// <param name="type">the return type of the expression</param>
 /// <param name="source">the source expression</param>
 /// <param name="memberExpression">property member name</param>
 /// <param name="resourceType">the element type of the resource</param>
 /// <param name="expandPaths">expand paths for resource set</param>
 /// <param name="countOption">count query option for the resource</param>
 /// <param name="customQueryOptions">custom query options for resource</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion)
     : base(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion)
 {
 }
Example #25
0
 internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion) : base(source, type, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion)
 {
     this.member = memberExpression;
     this.resourceType = resourceType;
     this.sequenceQueryOptions = new List<QueryOptionExpression>();
 }
 /// <summary>
 /// Creates a navigation resource expression
 /// </summary>
 /// <param name="type">the return type of the expression</param>
 /// <param name="source">the source expression</param>
 /// <param name="memberExpression">property member name</param>
 /// <param name="resourceType">the element type of the resource</param>
 /// <param name="expandPaths">expand paths for resource set</param>
 /// <param name="countOption">count query option for the resource</param>
 /// <param name="customQueryOptions">custom query options for resource</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 internal QueryableResourceExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion)
     : this(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion, null, null, false)
 {
 }
 /// <summary>
 /// Creates a singleton resource expression
 /// </summary>
 /// <param name="type">the return type of the expression</param>
 /// <param name="source">the source expression</param>
 /// <param name="memberExpression">property member name</param>
 /// <param name="resourceType">the element type of the resource</param>
 /// <param name="expandPaths">expand paths for resource set</param>
 /// <param name="countOption">count query option for the resource</param>
 /// <param name="customQueryOptions">custom query options for resource</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 /// <param name="functionName">name of function</param>
 /// <param name="functionParameters">parameters' names and values of function</param>
 /// <param name="isAction">action flag</param>
 internal SingletonResourceExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List <string> expandPaths, CountOption countOption, Dictionary <ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string functionName, Dictionary <string, string> functionParameters, bool isAction) :
     base(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion, functionName, functionParameters, isAction)
 {
     UseFilterAsPredicate = true;
 }
 /// <summary>
 /// Creates a resource set expression
 /// </summary>
 /// <param name="type">the return type of the expression</param>
 /// <param name="source">the source expression</param>
 /// <param name="memberExpression">property member name</param>
 /// <param name="resourceType">the element type of the resource</param>
 /// <param name="expandPaths">expand paths for resource set</param>
 /// <param name="countOption">count query option for the resource</param>
 /// <param name="customQueryOptions">custom query options for resource</param>
 /// <param name="projection">the projection expression</param>
 /// <param name="resourceTypeAs">TypeAs type</param>
 /// <param name="uriVersion">version of the Uri from the expand and projection paths</param>
 /// <param name="operationName">name of function</param>
 /// <param name="operationParameters">parameters' names and values of function</param>
 /// <param name="isAction">action flag</param>
 internal ResourceSetExpression(Type type, Expression source, Expression memberExpression, Type resourceType, List<string> expandPaths, CountOption countOption, Dictionary<ConstantExpression, ConstantExpression> customQueryOptions, ProjectionQueryOptionExpression projection, Type resourceTypeAs, Version uriVersion, string operationName, Dictionary<string, string> operationParameters, bool isAction)
     : base(type, source, memberExpression, resourceType, expandPaths, countOption, customQueryOptions, projection, resourceTypeAs, uriVersion, operationName, operationParameters, isAction)
 {
 }