u/Zardotab

▲ 6 r/dotnet

Factoring actions for common "stamp" columns in data model classes?

Most tables in our apps have standard shop "stamp" columns that track meta-data, such as when a record is added and changed, and who added or changed it (via user ID).

The assignment of these values is currently repeated for every table, making for an ugly DRY violation. Using inheritance seems the obvious solution, but inheritance for the model class is tricky because scaffolders generate and update those using EF. Our changes would get wiped out upon schema refresh.

Ideally we'd want a one or two line method call, such as "thisModel.UpdateCommonStamps()" for each table. Is there a clean way to achieve this? We also are moving to unit testing, so need something that's unit-test-friendly. Thank You.

reddit.com
u/Zardotab — 18 hours ago

Jesus' alleged resurrection doesn't seem like a strong miracle to me, what am I missing?

u/Zardotab — 6 days ago