Entity Versioning in a table

I have a database with many tables in it and I'd like to add Entity Versioning to all tables.

It looks like it can be done per-table by adding a [Version] attribute to it, but I cant find anything in Data Modeler settings that allows this attribute to be added either to an individual table or to all tables.

Have I missed something here ?

Ideally I'd like to have an option to add versioning to all tables globally and perhaps an override on each table.

AFAIK, Data Modeler versioning applies only to projects not to individual tables/objects.

A 'version' atribute is used for Aurelius concurrency control (calling 'record versioning' I guess is more apropriate than 'entity versioning')

Regards,

1 Like

You can always use Data Modeler customization scripts to automate such kind of things:

Thanks Wagner. I hadn't thought of that.

I have created the script as follows

procedure OnClassGenerated(Args: TClassGeneratedArgs);
var
  x: TCodeMemberField;
begin
  x := Args.CodeType.AddField('Fversion', 'integer', mvPrivate);
  x.AddAttribute('Column(''version'', [])');
  x.AddAttribute('Version');

  Args.CodeType.AddProperty('version', 'integer','Fversion', 'Fversion', mvPublic);    
end;

and that creates a private section like

    [Column('version', [])]
    [Version]
    Fversion: integer;

and a public section like

property version: integer read Fversion write Fversion;

which looks to be what I wanted, on every table. :slight_smile:

Thanks.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.