![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
12/16/2020
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Hi
In C#, when I add a stream state with the model compiler using:
<Object SymbolicName="MNS:MyStream1" TypeDefinition="ADI:StreamType">
</Object>
I do not get IsEnabled and IsForced in the configuration. However when I use the below code, I do.
var stream = new StreamState(this);
stream.Create(context, null, new QualifiedName("MyStream"), null, true);
this.AddChild(stream);
Why is this and how do I get my XML stream state to have the mentioned properties in the configuration?
Thanks for any help.
JC
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
DI:ParameterSet is optional so it does not appear unless explicitly declared in an instance.
The Server Object declaration has the same issue and deals with it by re-declaring instances as Mandatory:
You do not need to repeat information from the type since it will be automatically filled in.
In C# you have explicitly create optional children before calling Create.
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Search for the "Server" Object:
https://github.com/OPCFoundati.....dTypes.xml
In memory serves, the DI model does not follow the pattern that the C# code generator expects because of the un-typed folders with random properties and methods thrown into an instance. The lack of types means no named property accessors unless you add them in your own code.
1 Guest(s)