Show/Hide Toolbars

TMS Data Modeler Documentation

Navigation: TMS Aurelius Export > Customization Script

Adding a Unit Name to the Uses Clases

Scroll Prev Top Next More

This example adds a unit name "MyUnit" to the uses causes (interface section) of the unit "UnitName":

 

procedure OnUnitGenerated(Args: TUnitGeneratedArgs);
begin                                
  if Args.CodeUnit.Name = 'UnitName' then
    Args.CodeUnit.InterfaceUnits.Add(TCodeUsedUnit.Create('MyUnit'));
end;

 

It will add the following uses clause do the unit:

 

unit UnitName;
 
interface
                 
uses
  SysUtils, 
  Generics.Collections, 
  Aurelius.Mapping.Attributes, 
  Aurelius.Types.Blob, 
  Aurelius.Types.DynamicProperties, 
  Aurelius.Types.Nullable, 
  Aurelius.Types.Proxy, 
  MyUnit,
  Aurelius.Criteria.Dictionary;