Is your feature request related to a problem? Please describe.
There is currently no way to determine the primary key property or its type in an entity class. This causes me problems when using Entity Framework Power Tools to refresh a third party database in my solution, where I need the entity classes to inherit from a generic base class that takes the type of the primary key's property as the type parameter.
Describe the solution you'd like
Add three new expressions:
primary-key on entity type, specifying the name of the generated property holding the primary key value
primary-key-type on entity type, specifying the .NET type of the property above
property-primary-key on the primary key property itself, serving as a flag which can be used with #if in the Properties partial
Describe alternatives you've considered
No other alternatives are possible without having to carefully go through all changes in the generated entity type files and adapting each one by hand to add the base type inheritance (which also requires adding override for the "Id"/primary key property on each class).
Additional context
Add any other context or screenshots about the feature request here.
This is a situation where you will need to take full control of entity generation by extending HbsCSharpEntityTypeGenerator and overriding GenerateProperties. See here for an example of how to do that.
Is your feature request related to a problem? Please describe. There is currently no way to determine the primary key property or its type in an entity class. This causes me problems when using Entity Framework Power Tools to refresh a third party database in my solution, where I need the entity classes to inherit from a generic base class that takes the type of the primary key's property as the type parameter.
Describe the solution you'd like Add three new expressions:
primary-key
on entity type, specifying the name of the generated property holding the primary key valueprimary-key-type
on entity type, specifying the .NET type of the property aboveproperty-primary-key
on the primary key property itself, serving as a flag which can be used with#if
in the Properties partialDescribe alternatives you've considered No other alternatives are possible without having to carefully go through all changes in the generated entity type files and adapting each one by hand to add the base type inheritance (which also requires adding
override
for the "Id"/primary key property on each class).Additional context Add any other context or screenshots about the feature request here.