Attribute macro for position of element

Posts   
 
    
dodyg
User
Posts: 44
Joined: 04-Dec-2014
# Posted on: 07-Mar-2023 10:35:23   

I've read this documentation but I can't find a macro that generate an integer based on the position of the element in derived model.

This is my goal, to be able to generate Id attribute with assigned number based on the position of the property in the element.

public class MyData 
{
     [Id(0)]
     public string Name { get; set; }

     [Id(1)]
     public int Age{ get; set; }

     [Id(2)]
     public string Address{ get; set; }
}

Is this possible?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 08-Mar-2023 10:16:35   

There's no such macro defined, sorry. You have to hard-code that attribute on the fields for that type.

Frans Bouma | Lead developer LLBLGen Pro