Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different class name convention than Boiler example #186

Open
OlivierVerhaegen opened this issue Aug 7, 2024 · 4 comments
Open

Different class name convention than Boiler example #186

OlivierVerhaegen opened this issue Aug 7, 2024 · 4 comments

Comments

@OlivierVerhaegen
Copy link

Hi,

I noticed that the class names of my generated classes are different from the Boiler example.

I get:

    [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")]
    public partial class CounterTypeState : BaseObjectState
    {
        #region Constructors
        /// <remarks />
        public CounterTypeState(NodeState parent) : base(parent)
        {
        }

        /// <remarks />
        protected override NodeId GetDefaultTypeDefinitionId(NamespaceTable namespaceUris)
        {
            return Opc.Ua.NodeId.Create(Test.ObjectTypes.CounterType, Test.Namespaces.Test, namespaceUris);
        }
...

While in the Boiler example the "Type" in the class name is omitted, only the ObjectTypes have the word "Type" in them

   [System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")]
    public partial class BoilerState : BaseObjectState
    {
        #region Constructors
        /// <remarks />
        public BoilerState(NodeState parent) : base(parent)
        {
        }

        /// <remarks />
        protected override NodeId GetDefaultTypeDefinitionId(NamespaceTable namespaceUris)
        {
            return Opc.Ua.NodeId.Create(Boiler.ObjectTypes.BoilerType, Boiler.Namespaces.Boiler, namespaceUris);
        }
...

Am I missing a setting to omit "Type" from the State classes?
I did generate from a NodeSet2.xml instead of a ...Design.xml.

Best regards,
Olivier

@opcfoundation-org
Copy link
Contributor

No. When using a design file the tool strips the Type if the ClassName element is not set. There is no ClassName in a NodeSet2 file.

@OlivierVerhaegen
Copy link
Author

So if there is no ClassName in a NodeSet2 file, shouldn't it omit "Type" by default? As this is done in absence of the ClassName element for ...Design.xml files?

Can I get the same result using a NodeSet2 File?

@opcfoundation-org
Copy link
Contributor

opcfoundation-org commented Aug 7, 2024

The default is take BrowseName from the source and append 'State'
If it is model design file it strips the Type unless the ClassName specified then it uses the ClassName.
I guess the Type could be stripped but for NodeSets but it is not done now.

@OlivierVerhaegen
Copy link
Author

OlivierVerhaegen commented Aug 8, 2024

Okay thank you for the explanation. Could this become an option in a future release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants