Discriminator Enum Workaround?

Posts   
 
    
raterus
User
Posts: 4
Joined: 13-Apr-2016
# Posted on: 25-May-2016 20:28:27   

Hello,

This question is a followup to this question: https://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=23766

Basically I'm trying to configure an inheritance (Target per Entity Hierarchy) for a single table. I've made a new entity, that is a subtype of my root entity.

The problem is, in LLBLGen, we have the column I was to use as a discriminator surfacing as an enum in .Net. This keeps me from selecting this field in the UI as it is not showing. Also, we have quite a lot of code already written around this enum field, so I'd rather leave this alone.

I'm hoping there is a way I can work around this, obviously I could configure a new calculated field in my database that is the exact same value, and surface this one as an int, but that seems like overkill. I was hoping there was an option to fix this solely within LLBLGen.

** Edit: So I've found I need to set a discriminator value for the root entity. I'd kind of like to keep my root Entity alone (Discriminator = null), and it's mapped to all rows (including my child entities), and have my child Entity only map to what is specified in the discriminator.

Any ideas? --Michael

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-May-2016 06:02:51   

The discriminator field can't be null. You could opt to choose '0' or something like that as the value for the super-type.

AFAIK, you could use the field despite the type (including enums). However, as this is a discriminator value, and a field for inheritance, I would recommend to use the value as-is and not an enum, in this case is more natural and more maintainable this way.

David Elizondo | LLBLGen Support Team