So finally going down this path. Obviously, a lot of tables are now going to have a TenantID column. But I don't want to be writing TenantID everywhere, I want it to happen automatically. I can't think of any reason why any given thread would be dealing with multiple tenants at once.
I was thinking that I would have to radically update the templates to be smart to remove TenandID from the parameter lists, for example constructors, and then inside, get the TenantID from a thread scope variable on some other utility class I write. Whenever the win client app starts or the http request comes in, this TenantID would be set centrally.
Likewise, when doing searches, if the GetMulti call detects that the entity in question has a TenantID field, it would basically create a new Predicate that wraps the old predicate and adds an "AND TenantID=xxx" taken also from that thread scope variable.
Am I crazy? Should I just write TenantID everywhere and pray that developers will make sure to always add this also? I have to say, I do like the idea of it being automated away behind the scenes.
For the separate admin tool that manages the tenants, I would just use a normal library there with the standard templates.