Setting all model classes to use AutoInc as PrimaryKeyMapper
This page was created by Lars.olofsson on 2017-10-29. Last edited by Edgar on 2025-08-31.
Did you reverse a database and want to set all classes to use AutoInc for its primary key?
Here's an EAL for you:
Class.allInstances->select(c | c.TaggedValue->select(tv | tv.Tag='Eco.PrimaryKeyMapper')->isEmpty)
->collect(c |
let newtag = TaggedValue.Create in
(
newtag.Tag := 'Eco.PrimaryKeyMapper';
newtag.Value := 'AutoInc';
newtag.ModelElement := c
)
)
