示例#1
0
        /// <summary>
        /// Send a message to the server through the expression.
        /// </summary>
        /// <param name="message">The message to send.</param>
        /// <param name="predicateExpression">A function to test each element for a condition.</param>
        /// <param name="predicateString">The predicate query to use for the call.</param>
        /// <param name="values">The array of query values to apply to the predicate query.</param>
        /// <returns>The response message collection.</returns>
        private Message[] SendMessageExpressionEx(Message message,
                                                  Expression <Func <Message, bool> > predicateExpression = null,
                                                  string predicateString = null, params object[] values)
        {
            Message[] data = null;

            // Create the Generic Queryable Provider Inspector and
            // Assign the execution function handler.
            Linq.GenericQueryableProviderInspector <Message> query = new Linq.GenericQueryableProviderInspector <Message>();
            query.ExecuteAction = (Nequeo.Model.ExpressionTreeModel model) => GetQueryData(model);

            // If an expression predicate is used.
            if (predicateExpression != null)
            {
                data = query.QueryableProvider().Where(predicateExpression).ToArray();
            }

            // If a string predicate is used.
            if (!String.IsNullOrEmpty(predicateString))
            {
                data = query.QueryableProvider().Where(predicateString, values).ToArray();
            }

            // Return the data.
            return(data);
        }
示例#2
0
        /// <summary>
        /// The Select operation returns a set of attributes for ItemNames that match the
        /// select expression. Select is similar to the standard SQL SELECT statement.
        /// The total size of the response cannot exceed 1 MB in total size. Amazon SimpleDB
        /// automatically adjusts the number of items returned per page to enforce this limit.
        /// For example, if the client asks to retrieve 2500 items, but each individual item
        /// is 10 kB in size, the system returns 100 items and an appropriate NextToken so
        /// the client can access the next page of results.
        /// For information on how to construct select expressions, see Using Select to Create
        /// Amazon SimpleDB Queries in the Developer Guide.
        /// </summary>
        /// <typeparam name="TKey">The order by key selector type.</typeparam>
        /// <param name="where">The where clause predicate.</param>
        /// <param name="selector">The select clause predicate.</param>
        /// <param name="orderBy">The order by clause predicate.</param>
        /// <param name="take">The number of items to take.</param>
        /// <returns>The array of entity types.</returns>
        public T[] Select <TKey>(
            System.Linq.Expressions.Expression <Func <T, bool> > where,
            System.Linq.Expressions.Expression <Func <T, T> > selector,
            System.Linq.Expressions.Expression <Func <T, TKey> > orderBy, int take = 100)
        {
            T[] data = null;

            // Create the Generic Queryable Provider Inspector and
            // Assign the execution function handler.
            Linq.GenericQueryableProviderInspector <T> query = new Linq.GenericQueryableProviderInspector <T>();
            query.ExecuteAction = (Nequeo.Model.ExpressionTreeModel model) => GetQueryData(model);

            // If take is positive.
            if (take > -1)
            {
                // Take the amount of data.
                data = query.QueryableProvider().Where(where).Take(take).OrderBy(orderBy).Select(selector).ToArray();
            }
            else
            {
                // Get all the data.
                data = query.QueryableProvider().Where(where).OrderBy(orderBy).Select(selector).ToArray();
            }

            // Return the data.
            return(data);
        }
示例#3
0
        /// <summary>
        /// The Select operation returns a set of attributes for ItemNames that match the
        /// select expression. Select is similar to the standard SQL SELECT statement.
        /// The total size of the response cannot exceed 1 MB in total size. Amazon SimpleDB
        /// automatically adjusts the number of items returned per page to enforce this limit.
        /// For example, if the client asks to retrieve 2500 items, but each individual item
        /// is 10 kB in size, the system returns 100 items and an appropriate NextToken so
        /// the client can access the next page of results.
        /// For information on how to construct select expressions, see Using Select to Create
        /// Amazon SimpleDB Queries in the Developer Guide.
        /// </summary>
        /// <returns>The queryable provider.</returns>
        public Nequeo.Linq.QueryableProvider <T> Select()
        {
            // Create the Generic Queryable Provider Inspector and
            // Assign the execution function handler.
            Linq.GenericQueryableProviderInspector <T> query = new Linq.GenericQueryableProviderInspector <T>();
            query.ExecuteAction = (Nequeo.Model.ExpressionTreeModel model) => GetQueryData(model);

            // Return QueryableProvider.
            return(query.QueryableProvider());
        }