I have Class which worked perfectly with only the ID column as Key. Now I added the Name column as a Second Key (Using the Key(0) and Key(1) Attributes). But now I'm getting the following error message on Domain.Build: Default generator can serve hierarchy with exactly one key field.
|
The error indicates the following:
So what could be done in your case to resolve the issue? Option 1: manual key assignment Add the following constructor to your class (sorry, C# notation):
Option 2: semi-automatic key assignment As far as I can judge, you actually need to automatically generate a part of composite key - i.e. The simplest way to achieve this is to: a) Declare a dummy entity type having the same primitive key type as the one you'd like to generate:
This is necessary to ensure that key generator providing key values for its b) Add the following constructor to your class:
That's it. A brief explanation:
And a remark about tuples: Our
We use these objects as low-level data storage - e.g. any Since they have an API based on virtual methods, they're a bit slower in comparison to .NET tuples; on the other hand, such an approach allows us to provide a nice set of inheritors there. |