Skip to content

Commit

Permalink
Added Pre and PostConstruct in StructuredType
Browse files Browse the repository at this point in the history
  • Loading branch information
Brano5 committed Jun 28, 2024
1 parent 92722ba commit de38e12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,14 @@ public static CsOnlinerConstructorBuilder Create(IxNodeVisitor visitor, IStructu
HumanReadable = {typeof(Connector.Connector).n()}.CreateHumanReadable(parent.HumanReadable, readableTail);
Symbol = {typeof(Connector.Connector).n()}.CreateSymbol(parent.Symbol, symbolTail);");

builder.AddToSource(@$"PreConstruct(parent, readableTail, symbolTail);");

semantics.Fields.ToList().ForEach(p => p.Accept(visitor, builder));
builder.AddToSource("parent.AddChild(this);");
builder.AddToSource("parent.AddKid(this);");

builder.AddToSource(@$"PostConstruct(parent, readableTail, symbolTail);");

builder.AddToSource("}");

return builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ public static CsOnlinerMemberBuilder Create(IxNodeVisitor visitor, IStructuredTy
var builder = new CsOnlinerMemberBuilder(sourceBuilder);
builder.AddToSource(semantics.DeclareProperties());
semantics.Fields.ToList().ForEach(p => p.Accept(visitor, builder));

builder.AddToSource(@$"partial void PreConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);
partial void PostConstruct(AXSharp.Connector.ITwinObject parent, string readableTail, string symbolTail);");

return builder;
}

Expand Down

0 comments on commit de38e12

Please sign in to comment.