February 7, 2022 at 9:33 am
Apologies in advance, as I know this has been discussed a million times already but I think our requirement is slightly different from the norm in that we have a well-defined, static set of attributes up front and our values are rows in a table. But feel free to ignore if you've had enough of this subject already!
Our scenario is Notes.
Currently, we have implemented this via two columns on the Note table:
The main problem with this approach is the inability to establish a FK from EntityID to the Person, Service, Organisation, etc. tables. There might also be a performance implication too.
The problem with an alternative is that we have over 30 tables in the database that need to have Notes. My understanding is that there are two options for refactoring:
I'm assuming that the recommendation to "use XML" wouldn't work here because the "values" part of our existing EAV model isn't simply a value, such as 'red', 20/01/1935 or 27.55 for example - it's an entire row in a table.
So I'm starting to think we should just stick with the existing EntityID / ContentTypeID approach and hold our noses whenever we come across it.
But if you know of a better approach, I'd be very interested to hear it. Thanks.
February 7, 2022 at 10:18 am
Your existing method is probably the most practical. I considered other options and came to the same conclusions as you. I suggest that you stay well away from the XML 'recommendation', by the way!
If you wish to ensure no integrity violations, you could consider adding a suitable trigger to the Note table which contains the necessary lookup checks & prevents violations.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply