//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
using Luban;
using System.Text.Json;
namespace cfg.test
{
public sealed partial class TestRef : Luban.BeanBase
{
public TestRef(JsonElement _buf)
{
Id = _buf.GetProperty("id").GetInt32();
X1 = _buf.GetProperty("x1").GetInt32();
X1_Ref = null;
X12 = _buf.GetProperty("x1_2").GetInt32();
X12_Ref = null;
X2 = _buf.GetProperty("x2").GetInt32();
X3 = _buf.GetProperty("x3").GetInt32();
X4 = _buf.GetProperty("x4").GetInt32();
X4_Ref = null;
{ var __json0 = _buf.GetProperty("a1"); int _n0 = __json0.GetArrayLength(); A1 = new int[_n0]; int __index0=0; foreach(JsonElement __e0 in __json0.EnumerateArray()) { int __v0; __v0 = __e0.GetInt32(); A1[__index0++] = __v0; } }
{ var __json0 = _buf.GetProperty("a2"); int _n0 = __json0.GetArrayLength(); A2 = new int[_n0]; int __index0=0; foreach(JsonElement __e0 in __json0.EnumerateArray()) { int __v0; __v0 = __e0.GetInt32(); A2[__index0++] = __v0; } }
{ var __json0 = _buf.GetProperty("b1"); B1 = new System.Collections.Generic.List(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { int __v0; __v0 = __e0.GetInt32(); B1.Add(__v0); } }
{ var __json0 = _buf.GetProperty("b2"); B2 = new System.Collections.Generic.List(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { int __v0; __v0 = __e0.GetInt32(); B2.Add(__v0); } }
{ var __json0 = _buf.GetProperty("c1"); C1 = new System.Collections.Generic.HashSet(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { int __v0; __v0 = __e0.GetInt32(); C1.Add(__v0); } }
{ var __json0 = _buf.GetProperty("c2"); C2 = new System.Collections.Generic.HashSet(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { int __v0; __v0 = __e0.GetInt32(); C2.Add(__v0); } }
{ var __json0 = _buf.GetProperty("d1"); D1 = new System.Collections.Generic.Dictionary(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { int _k0; _k0 = __e0[0].GetInt32(); int _v0; _v0 = __e0[1].GetInt32(); D1.Add(_k0, _v0); } }
{ var __json0 = _buf.GetProperty("d2"); D2 = new System.Collections.Generic.Dictionary(__json0.GetArrayLength()); foreach(JsonElement __e0 in __json0.EnumerateArray()) { int _k0; _k0 = __e0[0].GetInt32(); int _v0; _v0 = __e0[1].GetInt32(); D2.Add(_k0, _v0); } }
E1 = _buf.GetProperty("e1").GetInt32();
E2 = _buf.GetProperty("e2").GetInt64();
E3 = _buf.GetProperty("e3").GetString();
F1 = _buf.GetProperty("f1").GetInt32();
F2 = _buf.GetProperty("f2").GetInt64();
F3 = _buf.GetProperty("f3").GetString();
S1 = test.RefDynamicBase.DeserializeRefDynamicBase(_buf.GetProperty("s1"));
}
public static TestRef DeserializeTestRef(JsonElement _buf)
{
return new test.TestRef(_buf);
}
public readonly int Id;
public readonly int X1;
public test.TestBeRef X1_Ref;
public readonly int X12;
public test.TestBeRef X12_Ref;
public readonly int X2;
public readonly int X3;
public readonly int X4;
public tag.TestTag X4_Ref;
public readonly int[] A1;
public readonly int[] A2;
public readonly System.Collections.Generic.List B1;
public readonly System.Collections.Generic.List B2;
public readonly System.Collections.Generic.HashSet C1;
public readonly System.Collections.Generic.HashSet C2;
public readonly System.Collections.Generic.Dictionary D1;
public readonly System.Collections.Generic.Dictionary D2;
public readonly int E1;
public readonly long E2;
public readonly string E3;
public readonly int F1;
public readonly long F2;
public readonly string F3;
public readonly test.RefDynamicBase S1;
public const int __ID__ = -543222491;
public override int GetTypeId() => __ID__;
public void ResolveRef(Tables tables)
{
X1_Ref = tables.TbTestBeRef.GetOrDefault(X1);
X12_Ref = tables.TbTestBeRef.GetOrDefault(X12);
X4_Ref = tables.TbTestTag.GetOrDefault(X4);
S1?.ResolveRef(tables);
}
public override string ToString()
{
return "{ "
+ "id:" + Id + ","
+ "x1:" + X1 + ","
+ "x12:" + X12 + ","
+ "x2:" + X2 + ","
+ "x3:" + X3 + ","
+ "x4:" + X4 + ","
+ "a1:" + Luban.StringUtil.CollectionToString(A1) + ","
+ "a2:" + Luban.StringUtil.CollectionToString(A2) + ","
+ "b1:" + Luban.StringUtil.CollectionToString(B1) + ","
+ "b2:" + Luban.StringUtil.CollectionToString(B2) + ","
+ "c1:" + Luban.StringUtil.CollectionToString(C1) + ","
+ "c2:" + Luban.StringUtil.CollectionToString(C2) + ","
+ "d1:" + Luban.StringUtil.CollectionToString(D1) + ","
+ "d2:" + Luban.StringUtil.CollectionToString(D2) + ","
+ "e1:" + E1 + ","
+ "e2:" + E2 + ","
+ "e3:" + E3 + ","
+ "f1:" + F1 + ","
+ "f2:" + F2 + ","
+ "f3:" + F3 + ","
+ "s1:" + S1 + ","
+ "}";
}
}
}