Skip to content

Commit

Permalink
[NEW-FEATURE] Improve naming and global access for generated types (#157
Browse files Browse the repository at this point in the history
)

* Create draft PR for #156

* adds global:: for accessing interpreters of a twin, suffixies poco configuration with `TwinController` to avoid confusion

* asp fixing test issue from previous commit

---------

Co-authored-by: PTKu <PTKu@users.noreply.github.com>
  • Loading branch information
PTKu and PTKu authored Apr 12, 2023
1 parent 9d0382d commit 3e1a305
Show file tree
Hide file tree
Showing 38 changed files with 68 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ private void CreateITwinObjectImplementation()
"public string HumanReadable { get; set; }" +
"protected System.String @SymbolTail { get; set;}" +
$"protected {typeof(ITwinObject).n()} @Parent {{ get; set; }}"+
$"public AXSharp.Connector.Localizations.Translator Interpreter => {Project.TargetProject.ProjectRootNamespace}.PlcTranslator.Instance;"
$"public AXSharp.Connector.Localizations.Translator Interpreter => global::{Project.TargetProject.ProjectRootNamespace}.PlcTranslator.Instance;"
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void CreateConfigDeclaration(IConfigDeclarationSyntax configDeclarationSy
IConfigurationDeclaration configurationDeclaration,
IxNodeVisitor visitor)
{
AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace}{{");
AddToSource($"public partial class {Project.TargetProject.ProjectRootNamespace}TwinController{{");
configurationDeclaration.Variables.ToList().ForEach(p => p.Accept(visitor, this));
AddToSource("}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class some_complex_type : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -315,6 +315,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -343,5 +343,5 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,5 +226,5 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial interface IImplementation1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial interface IContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial interface IContext_Multiple
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class ComplexType1 : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -300,6 +300,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class ComplexType1 : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -300,6 +300,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class ComplexType1 : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -302,6 +302,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

namespace SimpleFirstLevelNamespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class Complex : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -325,7 +325,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}

Expand Down Expand Up @@ -492,7 +492,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public enum Colors
Expand Down Expand Up @@ -670,7 +670,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class SomeClass : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -823,7 +823,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class Motor : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -972,7 +972,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class Vehicle : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -1129,7 +1129,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}

Expand Down Expand Up @@ -1300,7 +1300,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class Complex : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -1462,6 +1462,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public enum Colorss
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class ComplexMember : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -349,6 +349,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class ComplexMember : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -349,6 +349,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public enum Colors
Expand Down Expand Up @@ -345,7 +345,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class SomeClass : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -498,7 +498,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class Motor : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -647,7 +647,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class Vehicle : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -804,7 +804,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}

Expand Down Expand Up @@ -975,7 +975,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class Complex : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -1137,6 +1137,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}

public partial class referenced : AXSharp.Connector.ITwinObject
Expand Down Expand Up @@ -300,6 +300,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ public AXSharp.Connector.ITwinObject GetParent()

protected AXSharp.Connector.ITwinObject @Parent { get; set; }

public AXSharp.Connector.Localizations.Translator Interpreter => units.PlcTranslator.Instance;
public AXSharp.Connector.Localizations.Translator Interpreter => global::units.PlcTranslator.Instance;
}
}
Loading

0 comments on commit 3e1a305

Please sign in to comment.