Skipper - The ORM Designer Blog
  • Skipper - The ORM Designer
  • VsBuilds - Parallel building
  • Pulpo - Free Skipper CLI

How to create support for your own framework in ORM Designer, part III – custom ORM properties

Part III: How to define custom ORM properties for any object type (entity, field, module, association, …)

This article is a part of serial about implementation of a support for an own ORM into ORM Designer. Now we are going to show how to add definitions of single properties which are specific for our ORM framework. Each ORM framework has several specific properties which uses for its configuration. By these properties you can modify entity behaviours, a way of work with fields etc. Therefore ORM Designer has a complex system for definition of these properties.

Here is an article describing all options of ORM properties configuration. How to configure new ORM properties and data types. Then we recommend to check up other ORM frameworks configurations where you can find many of ORM properties definitions (available in application directory OrmDesignerCore\config). These definitions can serve you as examples of all options of usage.

Now lets show how we can set several attributes for entity and field in our AtomixORM framework.

<orm-configuration name="AtomixORM">
	<attribute name="TABLE">
		<attribute name="useTable" type="string" help="Custom database table name"/>
		<attribute name="cacheQueries" type="bool" help="Whether or not to cache queries for this entity."/>
	</attribute>
	<attribute name="COLUMN">
		 <attribute name="readonly"  type="bool" help="Checks if a field is modified."/>
	</attribute>
</orm-configuration>

After saving of above mentioned definition into our configuration file (and restarting ORM Designer) we can see following properties in ORM Designer:

Element description <attribute>

In our example we define 2 attributes for the entity and 1 for the field. The attribute definition is proceeded by writing down the element <attribute> with attribute name including one of following enabled values:

PROJECT, MODULE, REGION, TABLE, COLUMN, FOREIGN-KEY, FOREIGN-KEY-COLUMN, MANY-TO-MANY-RELATION, MANY-TO-MANY-FOREIGN-KEY, INDEX, INDEX-COLUMN, COMMENT, INHERITANCE-PARENT, INHERITANCE-CHILD.

Into this root <attribute> then we insert one or more child elements by which we create a hierarchy of the properties. Each element attribute can have following attributes:

  • name An attribute name, this attribute is required.
  • type An attribute data type. Currently the following values are enabled:
    • STRING, DECIMAL, FLOAT, BOOL: Simple values.
    • ENUM, ENUM-RO: Enumeration values. In case of using ENUM-RO isn’t possible to enter other value than pre-defined.
    • COLUMN, TABLE, TABLE-PARENTS, TABLE-CHILDREN. A list of fields, all entities or parent/children entities
    • PATH-RELATIVE, PATH-ABSOLUTE, FILE-RELATIVE, FILE-ABSOLUTE: File data types. Relative paths are relative to project root file (.ormdesigner)
    • STRUCT - Defines a complex data type which holds another property. If has any child, this type is automatically assigned.
    • LIST,SET - A list or set of structs
  • abstract Used in a combination with LIST/SET and STRUCT. If have abstract="true" flag then this attribute isn't displayed in ORM editor and show only children.
  • child-type Used in a combination with LIST/SET to define child types of this attribute.
  • default A default value, currently not implemented.
  • enum-value Defines values which are offered to a user when editing this attribute. Values are separated by .
  • help A help text displayed in the bottom of ORM editor.
  • help-url Url to more information about selected attribute. Currently not implemented.
  • inherit Defines another attribute to inherit all his childs. Usefull when lots of attribute share simmilar child values.
  • export-tag Export-tag is added to element when exporting model to ORM definitions. Usefull to add additional information for XML processing.
  • merge-column Used for internal usage only.

More information about ORM properties defining can be found in the article How to configure new ORM properties and data types.

  • Note: Names of each type spring from historical reasons from ERD diagram. That’s why in place of ENTITY is used TABLE etc.
  • Note2: Some of types can’t be currently visually edited in ORM Designer. These types are INDEX-COLUMN, INHERITANCE-PARENT a FOREIGN-KEY-COLUMN.

If you have any question about this or following chapter, don’t hesitate and ask us directly here on the blog or you can contact us at [email protected]

25 Aug 2010