Example #1
0
        private SsdsEntityBucket GetBucketFromExpression(Expression expression)
        {
            SsdsRestFacade        facade     = this.CreateFacade();
            SsdsExpressionVisitor translator = new SsdsExpressionVisitor();
            string criteria = translator.Translate(expression);
            var    response = facade.Get(criteria);

            var types = response.Elements().GroupBy(g => g.Name).Select(s => Type.GetType(s.Key.LocalName));

            return(new SsdsEntityBucket {
                Response = response, Types = types.ToArray()
            });
        }
Example #2
0
        /// <summary>
        /// Retrieves multiple object from the container when the match with a criteria.
        /// </summary>
        /// <param name="expression">The expression of the criteria used to determine which will be the object.</param>
        /// <returns>IEnumerable of T populated with data from Ssds.</returns>
        public IEnumerable <SsdsEntity <T> > Query <T>(Expression <Func <SsdsEntity <T>, bool> > expression) where T : class
        {
            SsdsRestFacade facade = this.CreateFacade();

            //since we are querying by kind... add it in
            expression = AddKindToExpression <T>(expression);

            SsdsExpressionVisitor translator = new SsdsExpressionVisitor();
            string criteria = translator.Translate(expression);

            var response = facade.Get(criteria);

            if (response == null)
            {
                return(null);
            }

            SsdsEntitySerializer <T>      serializer = new SsdsEntitySerializer <T>();
            IEnumerable <SsdsEntity <T> > items      = serializer.DeserializeMany(response);

            return(items);
        }