Example #1
0
        public FooVo GetSelectVo()
        {
            var fooVo = new FooVo();

            fooVo.Id          = "theId";
            fooVo.Name        = "theName";
            fooVo.Title       = "theTitle";
            fooVo.Description = "theDesc";

            fooVo.Set("a", "A");
            fooVo.Set("b", "B");
            fooVo.Set("C", "CC");

            return(fooVo);
        }
Example #2
0
        public IEnumerable <FooVo> GetSelectVos()
        {
            var mockItems = new Dictionary <string, object>();

            mockItems.Add("foo", "FOO");

            for (int i = 0; i < 2; i++)
            {
                var fooVo = new FooVo();
                fooVo.Id          = i.ToString("00");
                fooVo.Name        = "theName" + i.ToString("00");
                fooVo.Title       = "theTitle" + i.ToString("00");
                fooVo.Description = "theDesc" + i.ToString("00");

                fooVo.Set("a", "A");
                fooVo.Set("b", "B");
                fooVo.Set("C", "CC");
                fooVo.Set("bags", mockItems);
                yield return(fooVo);
            }
        }
Example #3
0
        public FooVo GetSelectVo2()
        {
            var fooVo = new FooVo();

            fooVo.Id          = "theId";
            fooVo.Name        = "theName";
            fooVo.Title       = "theTitle";
            fooVo.Description = "theDesc";

            fooVo.Set("a", "A");
            fooVo.Set("b", "B");
            fooVo.Set("C", "CC");

            //=> ~/Api/Foo/GetSelectVo?$includes=a,b&$excludes=b,c
            //=> {"a":"A","id":"theId","name":"theName","title":"theTitle","description":"theDesc"}

            //todo: add auto filter to pipelines
            var expandoSelect = ExpandoSelect.Parse(this.HttpContext);

            return(fooVo.ApplyExpandoSelect(expandoSelect));
        }
Example #4
0
        public FooVo GetSelectVoNoX()
        {
            var fooVo = new FooVo();

            fooVo.Id          = "theId";
            fooVo.Name        = "theName";
            fooVo.Title       = "theTitle";
            fooVo.Description = "theDesc";

            fooVo.Set("a", "A");
            fooVo.Set("b", "B");
            fooVo.Set("C", "CC");
            fooVo.Set("x", () =>
            {
                throw new InvalidOperationException("x is not allowed for now!");
                return("XXX");
            });

            //todo: add auto filter to pipelines
            var expandoSelect = ExpandoSelect.Parse(this.HttpContext);

            return(fooVo.ApplyExpandoSelect(expandoSelect));
        }