[Request] Is there a way to add 'Custom' Field Generator in the rtti attributes?

Home Forums kbmMW [Request] Is there a way to add 'Custom' Field Generator in the rtti attributes?

This topic contains 2 replies, has 2 voices, and was last updated by  Francisco Armando Dueñas Rodriguez 3 weeks, 6 days ago.

  • Author
    Posts
  • #54143

    Francisco Armando Dueñas Rodriguez
    Participant

    Hi I want to make a smal request if you can add an additional param to the generator attribute of a table class, to a reference to an class method or anonymous method, so there you can pass as param the current ORM instance managing the object, the instance of the object itself and a returning value.

    Example

    [kbmMW_Table(‘name:person, index:{name:i1,field:name,descending:false}, index:{name:i2,unique:true,fields:[{name:name,descending:true},{name:age}]’)]
    TPerson = class
    private
    FID:kbmMWNullable<string>;
    FName:kbmMWNullable<string>;
    FAddress:kbmMWNullable<string>;
    FAge:kbmMWNullable<integer>;
    public
    [kbmMW_Field(‘name:id, primary:true, generator:CUSTOM’,ftString,40,

    PROCEDURE (aORM: TkbmMWORM; aObject: TPerson; var aValue: TValue)

    begin

    end)]
    property ID:kbmMWNullable<string> read FID write FID;

    [kbmMW_Field(‘name:name’,ftWideString,50)]
    property FullName:kbmMWNullable<string> read FName write FName;

    [kbmMW_Field(‘name:address’,ftWideString,50)]
    property Address:kbmMWNullable<string> read FAddress write FAddress;

    [kbmMW_Field(‘name:age’,ftInteger)]
    property Age:kbmMWNullable<integer> read FAge write FAge;
    end;

    • This topic was modified 4 weeks ago by  Francisco Armando Dueñas Rodriguez.
  • #54148

    kimbomadsen
    Keymaster

    Hi,

    I understand the requirement for custom generators. I will look into it.

  • #54152

    Francisco Armando Dueñas Rodriguez
    Participant

    Thanks Kim, it can also be a method of the current class, but don’t know a way it can be called/specified  in the the attributes.  That will help because we can use the ‘self’ passed to the method to use directly the class instead of Casting it.

     

    regards

You must be logged in to reply to this topic.