Sub-issue of #755.
Why
Part of #755 is moving client samples onto generated client stubs — i.e. the C# source generator that implements IEncodeable (Encode/Decode/IsEqual/Clone) and type activators for custom OPC UA data types, instead of hand-written or ModelCompiler-emitted stub classes. The OPCFoundation.NetStandard.Opc.Ua.SourceGeneration analyzer package is already referenced by some projects in this repo.
Scope
Client-side custom data type / model stub code across the samples, e.g.:
Workshop/DataTypes (custom data types)
Workshop/Boiler, Workshop/SimpleEvents, Workshop/AlarmCondition model/type classes
- Any other sample with hand-written or generated
IEncodeable stub classes consumed by clients (audit repo-wide)
Tasks
- Add the
OPCFoundation.NetStandard.Opc.Ua.SourceGeneration package as an analyzer (OutputItemType="Analyzer" ReferenceOutputAssembly="false") to the affected projects.
- Convert custom data types to
partial classes/enums annotated with [DataType(Namespace = "...")]; remove hand-written Encode/Decode/IsEqual/Clone and manual activator registration — let the generator emit them.
- Verify complex-type reads/writes still round-trip on the client (works with
Opc.Ua.Client.ComplexTypes).
- Confirm the generated
TypeId/BinaryEncodingId/XmlEncodingId match the sample server nodesets.
Note: please confirm with maintainers whether "generated client stubs" in #755 also covers a specific typed service/method-stub generator beyond source-generated data types; adjust scope if so.
References
Acceptance criteria
- Affected sample projects build with the source generator; no hand-written
IEncodeable boilerplate remains for the converted types.
- Clients still encode/decode and display custom data types correctly against the sample servers.
Dependencies
Can proceed in parallel with the session/subscription sub-issues; coordinate merge order to avoid churn in the same client files.
Sub-issue of #755.
Why
Part of #755 is moving client samples onto generated client stubs — i.e. the C# source generator that implements
IEncodeable(Encode/Decode/IsEqual/Clone) and type activators for custom OPC UA data types, instead of hand-written or ModelCompiler-emitted stub classes. TheOPCFoundation.NetStandard.Opc.Ua.SourceGenerationanalyzer package is already referenced by some projects in this repo.Scope
Client-side custom data type / model stub code across the samples, e.g.:
Workshop/DataTypes(custom data types)Workshop/Boiler,Workshop/SimpleEvents,Workshop/AlarmConditionmodel/type classesIEncodeablestub classes consumed by clients (audit repo-wide)Tasks
OPCFoundation.NetStandard.Opc.Ua.SourceGenerationpackage as an analyzer (OutputItemType="Analyzer" ReferenceOutputAssembly="false") to the affected projects.partialclasses/enums annotated with[DataType(Namespace = "...")]; remove hand-writtenEncode/Decode/IsEqual/Cloneand manual activator registration — let the generator emit them.Opc.Ua.Client.ComplexTypes).TypeId/BinaryEncodingId/XmlEncodingIdmatch the sample server nodesets.References
Acceptance criteria
IEncodeableboilerplate remains for the converted types.Dependencies
Can proceed in parallel with the session/subscription sub-issues; coordinate merge order to avoid churn in the same client files.