12 - Create a New Shared Type
Problem
A field with the same properties is frequently included in multiple MetaEd files (sometimes with different field names) and the field properties must be defined each time.
Solution
Define a shared type. Instead of defining field properties each time the field is included, reference the shared type, renaming it as appropriate for each reference.
Discussion
A shared type is a field with a predefined set of properties that can be referenced in multiple MetaEd files.
MetaEd allows for three types of fields to be predefined as shared types:
- Shared decimals
- Shared integers
- Shared strings
Consider these two MetaEd files, both referencing a decimal field with 18 total digits, 4 decimal places, and a minimum value of 0.
Domain Entities without Shared Simple Types
Instead, create a shared type to define the properties of this particular shared decimal.
Shared Decimal - GPA
Then, reference the shared decimal in the MetaEd files, renaming each instance with the keyword "named" followed by the desired name of the reference. The documentation may also be specific to each reference.
Domain Entities with Shared Simple Types
Though shared types are sometimes renamed when referenced in a MetaEd file, renaming is not required as long as there is only one reference to the shared type within each file.