コード例 #1
0
        public void Test_Select_Json_Parameter()
        {
            var options = new JsonSerializerOptions()
            {
                PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                IgnoreNullValues     = true,
            };
            var store = DatabaseHelper.Default.GetStore();

            store.Use(new JsonBindingContractResolver(options));

            var data = new BlogJsonView()
            {
                Blog = new Blog()
                {
                    Id = 12
                }
            };
            var model        = store.From(data).Lookup("Blog");
            var parameter    = new Parameter("P0", model);
            var sqlParameter = new SqliteParameter();
            var expected     = JsonSerializer.Serialize(data.Blog, options);

            parameter.Build(sqlParameter);

            sqlParameter.Value.ShouldBe(expected);
        }
コード例 #2
0
        public void Test_Select_JsonDocument_Parameter()
        {
            var options = new JsonSerializerOptions()
            {
                PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                IgnoreNullValues     = true,
            };
            var store = DatabaseHelper.Default.GetStore();

            store.Use(new JsonBindingContractResolver(options));

            var json          = "{\"Hello\":\"World!\"}";
            var data1         = JsonDocument.Parse(json);
            var data2         = data1.RootElement;
            var parameter1    = new Parameter("P0", store.From(data1));
            var parameter2    = new Parameter("P1", store.From(data2));
            var sqlParameter1 = new SqliteParameter();
            var sqlParameter2 = new SqliteParameter();

            parameter1.Build(sqlParameter1);
            parameter2.Build(sqlParameter2);

            sqlParameter1.Value.ShouldBe(json);
            sqlParameter2.Value.ShouldBe(json);
        }
コード例 #3
0
ファイル: ContractScript.cs プロジェクト: dmirgaleev/netezos
 public IMicheline BuildParameter(string entrypoint, params object[] values)
 => Parameter.Build(entrypoint, values);
コード例 #4
0
ファイル: ContractScript.cs プロジェクト: dmirgaleev/netezos
 public IMicheline BuildParameter(string entrypoint, object value)
 => Parameter.Build(entrypoint, value);