Our database has an Attribute
table and a WorkItem
table that are in a many to many relationship using a WorkItemAttribute
table. The WorkItemAttribute
table contains the foreign keys for each and a value
column specifying the value of the associated attribute.
I wrote a simple CRUD web api and tests dealing with the WorkItemAttribute
s on a per WorkItemID
basis using an ORM provider.
I was then tasked with doing the same for an EnvelopeAttribute
table, which is the same as the WorkItemAttribute
table but has a foreign key to an Envelope
table instead.
I can duplicate everything I wrote for the first ticket, and change all the occurrences of "Envelope" to "WorkItem", but it really bugs me doing so.
Is there any way to refactor the shared logic when all the class names are different, even at the ORM level?