Page 1 of 1

Problem with generics in auto-generated code (.NET)

Posted: 28 Aug 2017, 17:24
by aliner

I am generating .NET code from modeller.
The generic type of RelativeLocation VariableType below should be compatible with its super type that is not generic.
Therefore T should get a constraint of being a vector or a subtype of vector (see in red).
The red part of code is not generated automatically and causes compilation problems and inconsistency.

/// <summary>
/// A typed object which represents a RelativeLocation.
/// </summary>
public partial class RelativeLocation<T> : RelativeLocation where T : Vector
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>
/// The value.
/// </value>
[UaInstanceDeclaration(IsValue = true, NamespaceUri = IRIS.DDHub.Namespaces.DDHub)]
public new T Value
get { return (T)((base.Value)??default(T)); }
set { base.Value = value; }

Re: Problem with generics in auto-generated code (.NET)

Posted: 07 Sep 2017, 16:00
by Support Team

How does your model look like? Especially we need to know the DataType of RelativePath and the DataType of the supertype of RelativePath. Please tell us in more detail what are you expecting to be generated.

There are some generated code files that should not be edited. The file defing the model classes si one of them. Please see the file header of each file.