Setting all model classes to use AutoInc as PrimaryKeyMapper
(Created page with "Reversed a database and wanting to set all classes to use AutoInc for it's primary key? Here's an EAL for you; Class.allInstances->select(c | c.TaggedValue->select(tv | tv....")
 
(Automatically adding template at the end of the page.)
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Reversed a database and wanting to set all classes to use AutoInc for it's primary key?
Did you reverse a database and want to set all classes to use AutoInc for its primary key?


Here's an EAL for you;
Here's an EAL for you:


  Class.allInstances->select(c | c.TaggedValue->select(tv | tv.Tag='Eco.PrimaryKeyMapper')->isEmpty)
  Class.allInstances->select(c | c.TaggedValue->select(tv | tv.Tag='Eco.PrimaryKeyMapper')->isEmpty)
Line 12: Line 12:
   )
   )
  )
  )
[[Category:EAL]]
{{Edited|July|12|2024}}

Revision as of 15:46, 10 February 2024

This page was created by Lars.olofsson@mdriven.net on 2017-10-29. Last edited by Edgar on 2025-01-20.

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
  )
)
MDriven Chat

How would you like to chat today?

Setting up your conversation…

This may take a few moments