コード例 #1
0
        static Program()
        {
            s_userContract = new JsonContract <User>();
            s_userContract.SimpleProperty(u => u.UserName).Name("Name");
            s_userContract.SimpleProperty(u => u.Age);

            s_postContract = new JsonContract <Post>();
            s_postContract.SimpleProperty(p => p.Title);
            s_postContract.SimpleProperty(p => p.CreateTime).Converter(new DataTimeConverter());

            s_categoryContract = new JsonContract <Category>();
            s_categoryContract.SimpleProperty(p => p.Name);
            s_categoryContract.ComplexProperty(p => p.Author).Contract(s_userContract);
            s_categoryContract.ArrayProperty(p => p.Posts).ElementContract(s_postContract);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: JeffreyZhao/JsonMe
        static Program()
        {
            s_userContract = new JsonContract<User>();
            s_userContract.SimpleProperty(u => u.UserName).Name("Name");
            s_userContract.SimpleProperty(u => u.Age);

            s_postContract = new JsonContract<Post>();
            s_postContract.SimpleProperty(p => p.Title);
            s_postContract.SimpleProperty(p => p.CreateTime).Converter(new DataTimeConverter());

            s_categoryContract = new JsonContract<Category>();
            s_categoryContract.SimpleProperty(p => p.Name);
            s_categoryContract.ComplexProperty(p => p.Author).Contract(s_userContract);
            s_categoryContract.ArrayProperty(p => p.Posts).ElementContract(s_postContract);
        }