Builder API Basic Methods

General

All builders that derive from MetadataBuilderBase will have the Builder property available to them. That property can be used to add, remove or retrieve metadata from the current model. The type behind the property is ModelBuilder - so the builder is already scoped to the current model.

Add

Class

To add an additional class simply use:

Builder.Add.Class(nameof(Elements.Office));

This will return an instace of ClassBuilder that can be used to furhter configure the created class.

A class with some additional configurations:

Builder.Add.Class(nameof(Elements.Office)) .Caption(SwissGerman, "BĂĽro") .PluralCaption(SwissGerman, "BĂĽros") .NoCodeGeneration() .Sort("Name", SortDirection.Descending);

There's a fallback available in case the developer needs access to the underlying IMetaClass:

Builder.Add.Class(nameof(Elements.Office)) .Configure(cls => { // Do something with the IMetaClass });

Property

To add an additional property simply use:

This will return an instace of PropertyBuilder that can be used to furhter configure the created property.

A property with some additional configurations:

There's a fallback available in case the developer needs access to the underlying IMetaProperty:

Relation

To add a relation simply use:

This will return an instance of RelationBuilder that can be used to further configure the created relation.

In der folgenden Tabelle werden die unterschiedlichen AssociationType-Werte und die damit verbundene Platzierung des ForeignKeys und dessen Nullability beschrieben.

Quell-Tabelle

Quell-FK

Quell-Kardinalität

AssociationType

Ziel-Kardinalität

Ziel-Tabelle

Ziel-FK

Quell-Tabelle

Quell-FK

Quell-Kardinalität

AssociationType

Ziel-Kardinalität

Ziel-Tabelle

Ziel-FK

A

 

1

OneToZeroOrOne

0-1

B

AId*

A

BId

0-1

ZeroOrOneToZeroOrOne

0-1

B

 

A

BId*

0-1

ZeroOrOneToOne

1

B

 

A

 

0-1

ZeroOrOneToMany

n

B

AId

A

 

1

OneToMany

n

B

AId*

A

BId

n

ManyToZeroOrOne

0-1

B

 

A

BId*

n

ManyToOne

1

B

 

Bei der ZeroOrOneToZeroOrOne Verbindung ist auch die Platzierung des FK auf der anderen Seite denkbar. Wir haben uns aber dazu entschieden, bei einer ZeroOrOneToZeroOrOne-Verbindung von A nach B den FK in A zu platzieren, damit auf A per SearchEdit ein B ausgewählt werden kann.

A relation with some additional configurations:

There's a fallback available in case the developer needs access to the underlying generated elements:

Remove

The Builder exposes a property Remove that can be used to either remove a class or property from the model.

Get

The Builder exposes a property Get that can be used to either retrieve a class or property from the model.

Â