I need to create a class library based on an EXPRESS schema. The EXPRESS schema has types and entities looking like the following:
ENTITY IfcRoot
ABSTRACT SUPERTYPE OF (ONEOF
(IfcObjectDefinition
,IfcPropertyDefinition
,IfcRelationship));
GlobalId : IfcGloballyUniqueId;
OwnerHistory : OPTIONAL IfcOwnerHistory;
Name : OPTIONAL IfcLabel;
Description : OPTIONAL IfcText;
UNIQUE
UR1 : GlobalId;
END_ENTITY;
In here GlobalId, OwnerHistory, Name, and Description are all properties of the class IfcRoot. The property type of for example "Name" is IfcLabel, which is given as a TYPE in the EXPRESS schema looking like this:
TYPE IfcLabel = STRING(255);
END_TYPE;
This type is of the type String or well string array. In my approach, I implemented all the entities in the schema and all the types in the schema as classes in chsharp. Therefore I wrote a string-reader, that reads the schema and creates the entities (~800) and the types (~400) based on that. IfcLabel in my implementation looks like this:
public class IfcLabel
{
public string _value { get; set; }
}
It all works completely fine, but when I want to use my class library it is really laborious due to the fact that each attribute type is a class itself. Meaning I have to create an object of the IfcLabel-Class first and assign the _value property and then create my IfcRoot-object and assign the Name-property as the IfcLabel-object. Does anyone have an idea, how I can implement that in a smarter way? There is one more thing to add: all types need to have a method and inherit from a class called IfcBase so that still needs to be possible. I am also not allowed to directly change the property type from IfcLabel to string, which it actually is in the end anyway.