【调整】跟随brightdb调整,生成与最新版本相匹配的代码

main
walon 2021-11-04 16:22:28 +08:00
parent 8a41b5bc83
commit bf03d47784
6 changed files with 17 additions and 17 deletions

View File

@ -32,7 +32,7 @@ namespace Luban.Job.Db.Defs
public string InternalTableType => "_" + Name; public string InternalTableType => "_" + Name;
public string BaseTableType => $"Bright.Transaction.{(KeyTType is TLong ? "Long" : "String")}TxnTable<{ValueTType.Apply(DbCsDefineTypeVisitor.Ins)}>"; public string BaseTableType => $"BrightDB.Transaction.{(KeyTType is TLong ? "Long" : "String")}TxnTable<{ValueTType.Apply(DbCsDefineTypeVisitor.Ins)}>";
public override void Compile() public override void Compile()
{ {

View File

@ -15,17 +15,17 @@ namespace Luban.Job.Db.TypeVisitors
public override string Accept(TList type) public override string Accept(TList type)
{ {
return $"Bright.Transaction.Collections.{(type.ElementType is TBean ? " PList2" : "PList1")}<{type.ElementType.Apply(this)}>"; return $"BrightDB.Transaction.Collections.{(type.ElementType is TBean ? " PList2" : "PList1")}<{type.ElementType.Apply(this)}>";
} }
public override string Accept(TSet type) public override string Accept(TSet type)
{ {
return $"Bright.Transaction.Collections.PSet<{type.ElementType.Apply(this)}>"; return $"BrightDB.Transaction.Collections.PSet<{type.ElementType.Apply(this)}>";
} }
public override string Accept(TMap type) public override string Accept(TMap type)
{ {
return $"Bright.Transaction.Collections.{(type.ValueType is TBean ? " PMap2" : "PMap1")}<{type.KeyType.Apply(this)}, {type.ValueType.Apply(this)}>"; return $"BrightDB.Transaction.Collections.{(type.ValueType is TBean ? " PMap2" : "PMap1")}<{type.KeyType.Apply(this)}, {type.ValueType.Apply(this)}>";
} }
} }
} }

View File

@ -29,7 +29,7 @@ public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_d
/// {{x.escape_comment}} /// {{x.escape_comment}}
/// </summary> /// </summary>
{{~end~}} {{~end~}}
public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Transaction.TxnBeanBase {{end}}, {{readonly_name}} public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} BrightDB.Transaction.TxnBeanBase {{end}}, {{readonly_name}}
{ {
{{~ for field in fields~}} {{~ for field in fields~}}
{{if is_abstract_type}}protected{{else}}private{{end}} {{db_cs_define_type field.ctype}} {{field.internal_name}}; {{if is_abstract_type}}protected{{else}}private{{end}} {{db_cs_define_type field.ctype}} {{field.internal_name}};
@ -46,7 +46,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
{{ctype = field.ctype}} {{ctype = field.ctype}}
{{~if has_setter ctype~}} {{~if has_setter ctype~}}
private sealed class {{field.log_type}} : Bright.Transaction.FieldLogger<{{name}}, {{db_cs_define_type ctype}}> private sealed class {{field.log_type}} : BrightDB.Transaction.FieldLogger<{{name}}, {{db_cs_define_type ctype}}>
{ {
public {{field.log_type}}({{name}} self, {{db_cs_define_type ctype}} value) : base(self, value) { } public {{field.log_type}}({{name}} self, {{db_cs_define_type ctype}} value) : base(self, value) { }
@ -74,7 +74,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
{ {
if (this.IsManaged) if (this.IsManaged)
{ {
var txn = Bright.Transaction.TransactionContext.ThreadStaticCtx; var txn = BrightDB.Transaction.TransactionContext.ThreadStaticCtx;
if (txn == null) return {{field.internal_name}}; if (txn == null) return {{field.internal_name}};
var log = ({{field.log_type}})txn.GetField(this.GetObjectId() + {{field.id}}); var log = ({{field.log_type}})txn.GetField(this.GetObjectId() + {{field.id}});
return log != null ? log.Value : {{field.internal_name}}; return log != null ? log.Value : {{field.internal_name}};
@ -91,7 +91,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
{{~end~}} {{~end~}}
if (this.IsManaged) if (this.IsManaged)
{ {
var txn = Bright.Transaction.TransactionContext.ThreadStaticCtx; var txn = BrightDB.Transaction.TransactionContext.ThreadStaticCtx;
txn.PutField(this.GetObjectId() + {{field.id}}, new {{field.log_type}}(this, value)); txn.PutField(this.GetObjectId() + {{field.id}}, new {{field.log_type}}(this, value));
{{~if ctype.need_set_children_root}} {{~if ctype.need_set_children_root}}
value?.InitRoot(GetRoot()); value?.InitRoot(GetRoot());
@ -125,7 +125,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
/// {{field.escape_comment}} /// {{field.escape_comment}}
/// </summary> /// </summary>
{{~end~}} {{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.convention_name}} => new Bright.Transaction.Collections.PReadOnlyMap<{{db_cs_readonly_define_type ctype.key_type}}, {{db_cs_readonly_define_type ctype.value_type}}, {{db_cs_define_type ctype.value_type}}>({{field.internal_name}}); {{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.convention_name}} => new BrightDB.Transaction.Collections.PReadOnlyMap<{{db_cs_readonly_define_type ctype.key_type}}, {{db_cs_readonly_define_type ctype.value_type}}, {{db_cs_define_type ctype.value_type}}>({{field.internal_name}});
{{~end~}} {{~end~}}
{{~end~}} {{~end~}}
@ -180,7 +180,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
public override int GetTypeId() => ID; public override int GetTypeId() => ID;
{{~end~}} {{~end~}}
protected override void InitChildrenRoot(Bright.Storage.TKey root) protected override void InitChildrenRoot(BrightDB.Storage.TKey root)
{ {
{{~ for field in hierarchy_fields~}} {{~ for field in hierarchy_fields~}}
{{~if need_set_children_root field.ctype~}} {{~if need_set_children_root field.ctype~}}

View File

@ -5,7 +5,7 @@ namespace {{namespace}}
public static class {{name}} public static class {{name}}
{ {
public static System.Collections.Generic.List<Bright.Transaction.TxnTable> TableList { get; } = new System.Collections.Generic.List<Bright.Transaction.TxnTable> public static System.Collections.Generic.List<BrightDB.Transaction.TxnTable> TableList { get; } = new System.Collections.Generic.List<BrightDB.Transaction.TxnTable>
{ {
{{~ for table in tables~}} {{~ for table in tables~}}
{{table.full_name}}.Table, {{table.full_name}}.Table,

View File

@ -29,7 +29,7 @@ public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_d
/// {{x.escape_comment}} /// {{x.escape_comment}}
/// </summary> /// </summary>
{{~end~}} {{~end~}}
public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Transaction.TxnBeanBase {{end}}, {{readonly_name}} public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} BrightDB.Transaction.TxnBeanBase {{end}}, {{readonly_name}}
{ {
{{~ for field in fields~}} {{~ for field in fields~}}
{{if is_abstract_type}}protected{{else}}private{{end}} {{db_cs_define_type field.ctype}} {{field.internal_name}}; {{if is_abstract_type}}protected{{else}}private{{end}} {{db_cs_define_type field.ctype}} {{field.internal_name}};
@ -46,7 +46,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
{{ctype = field.ctype}} {{ctype = field.ctype}}
{{~if has_setter ctype~}} {{~if has_setter ctype~}}
private sealed class {{field.log_type}} : Bright.Transaction.FieldLogger<{{name}}, {{db_cs_define_type ctype}}> private sealed class {{field.log_type}} : BrightDB.Transaction.FieldLogger<{{name}}, {{db_cs_define_type ctype}}>
{ {
public {{field.log_type}}({{name}} self, {{db_cs_define_type ctype}} value) : base(self, value) { } public {{field.log_type}}({{name}} self, {{db_cs_define_type ctype}} value) : base(self, value) { }
@ -74,7 +74,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
{ {
if (this.IsManaged) if (this.IsManaged)
{ {
var txn = Bright.Transaction.TransactionContext.ThreadStaticCtx; var txn = BrightDB.Transaction.TransactionContext.ThreadStaticCtx;
if (txn == null) return {{field.internal_name}}; if (txn == null) return {{field.internal_name}};
var log = ({{field.log_type}})txn.GetField(this.GetObjectId() + {{field.id}}); var log = ({{field.log_type}})txn.GetField(this.GetObjectId() + {{field.id}});
return log != null ? log.Value : {{field.internal_name}}; return log != null ? log.Value : {{field.internal_name}};
@ -91,7 +91,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
{{~end~}} {{~end~}}
if (this.IsManaged) if (this.IsManaged)
{ {
var txn = Bright.Transaction.TransactionContext.ThreadStaticCtx; var txn = BrightDB.Transaction.TransactionContext.ThreadStaticCtx;
txn.PutField(this.GetObjectId() + {{field.id}}, new {{field.log_type}}(this, value)); txn.PutField(this.GetObjectId() + {{field.id}}, new {{field.log_type}}(this, value));
{{~if ctype.need_set_children_root}} {{~if ctype.need_set_children_root}}
value?.InitRoot(GetRoot()); value?.InitRoot(GetRoot());
@ -125,7 +125,7 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
/// {{field.escape_comment}} /// {{field.escape_comment}}
/// </summary> /// </summary>
{{~end~}} {{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.convention_name}} => new Bright.Transaction.Collections.PReadOnlyMap<{{db_cs_readonly_define_type ctype.key_type}}, {{db_cs_readonly_define_type ctype.value_type}}, {{db_cs_define_type ctype.value_type}}>({{field.internal_name}}); {{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.convention_name}} => new BrightDB.Transaction.Collections.PReadOnlyMap<{{db_cs_readonly_define_type ctype.key_type}}, {{db_cs_readonly_define_type ctype.value_type}}, {{db_cs_define_type ctype.value_type}}>({{field.internal_name}});
{{~end~}} {{~end~}}
{{~end~}} {{~end~}}

View File

@ -5,7 +5,7 @@ namespace {{namespace}}
public static class {{name}} public static class {{name}}
{ {
public static System.Collections.Generic.List<Bright.Transaction.TxnTable> TableList { get; } = new System.Collections.Generic.List<Bright.Transaction.TxnTable> public static System.Collections.Generic.List<BrightDB.Transaction.TxnTable> TableList { get; } = new System.Collections.Generic.List<BrightDB.Transaction.TxnTable>
{ {
{{~ for table in tables~}} {{~ for table in tables~}}
{{table.full_name}}.Table, {{table.full_name}}.Table,