コード例 #1
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));
        }
コード例 #2
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));
        }