Way to extend autogenerated entity classes.

Posts   
 
    
stanislavb
User
Posts: 1
Joined: 12-Nov-2010
# Posted on: 12-Nov-2010 15:01:25   

Hi, we've got a data project in our solution that is entirely created by LLBLGen.

But we need to use attributes for some of generated entity classes. Normal way is to use Metadata class but this should be specified as an attribute for entity class and the only way to add a custom attribute to auto generated class that I've found is using partial classes. And since custom partial classes are specified in .csproj file, they're gonna disappear after refreshing code from a DB.

What is the best way to accomplish this task? What are ways to add and keep custom files in proj files generated by LLBLGen and to mark autogenerated classes and their fields with own attributes?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-Nov-2010 07:08:16   

Here is a thread of something similar. A guy looking for a way to hide properties, adding the MetaDataAttribute using buddy classes. In the templates you have access to entity and field properties. I think that would be helpful. http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=18673&StartAtMessage=0&#104946

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 15-Nov-2010 17:36:14   

In v3, you can add attribute definitions to the fields / entities inside the designer. If you're using v3, please see: http://www.llblgen.com/documentation/3.0/Designer/hh_goto.htm#Functionality%20Reference/AttributeDefinitionMacros.htm

and follow the links at the top of the page to other pages describing where to add the attribute definitions.

Frans Bouma | Lead developer LLBLGen Pro