Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

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

...

Code Block
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:

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

Property

To add an additional property simply use:

Code Block
Builder.Add.Property(Elements.Office, "Name", MetaType.Text);

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

...

Code Block
Builder.Add.Property(Elements.Office, "ShowPeople", MetaType.Boolean)
  .Caption(SwissGerman, "Personen anzeigen")
  .Required()
  .Transient()
  .DefaultExpression("true");

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

Code Block
Builder.Add.Property(Elements.Office, "ShowPeople", MetaType.Boolean)
        .Configure(prop =>
        {
          // Do something with the IMetaProperty
        });

Relation

To add a relation simply use:

Code Block
Builder.Add.Relation(Elements.Company, AssociationType.ZeroOrOneToMany, Elements.Office, MetaPathRule.Cascade)

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

...

Quell-Tabelle

Quell-FK

Quell-Kardinalität

AssociationType

Ziel-Kardinalität

Ziel-Tabelle

Ziel-FK

A

 

1

OneToZeroOrOne

0-1

B

AidAId*

A

Bid*BId

0-1

OneToOneZeroOrOneToZeroOrOne

0-1

B

 

A

BidBId*

0-1

ZeroOrOneToOne

1

B

 

A

 

0-1

ZeroOrOneToMany

n

B

AidAId

A

 

1

OneToMany

n

B

AidAId*

A

BidBId

n

ManyToZeroOrOne

0-1

B

 

A

BidBId*

n

ManyToOne

1

B

 

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

...

Code Block
Builder.Add.Relation(Elements.Company, AssociationType.ZeroOrOneToMany, Elements.Office, MetaPathRule.Cascade)
  .Caption(SwissGerman, "Büros")
  .InverseCaption(SwissGerman, "Firma")
  .Control(nameof(ControlType.GridEditor))
  .InverseControl(nameof(ControlType.SearchEdit))
  .InverseLayout(LayoutType.Detail, "CompactLayout")
  .Rename("Offices");

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

Code Block
Builder.Add.Relation(Elements.Company, AssociationType.ZeroOrOneToMany, Elements.Office, MetaPathRule.Cascade)
  .Configure(tuple =>
  {
    // tuple.relation;
    // tuple.inverseRelation;
    // tuple.foreignKey;
    // tuple.path;
    // tuple.index;
  });

Remove

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

Code Block
Builder.Remove.Class("Office");
Builder.Remove.Property("Office", "Name");

Get

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

...