dolittle-obsolete / DotNET.Fundamentals

Reusable, fundamental abstractions and building blocks
http://www.dolittle.io
MIT License
4 stars 8 forks source link

Tenant Specific Bindings for the IoC container #256

Open smithmx opened 4 years ago

smithmx commented 4 years ago

We should be able to register implementations on a per tenant basis.

This will have to be in addition to the normal "lifetime" scopes.

So if I have an InstancePerExecutionContext() which controls the lifetime of instances of the implementation, InstancePerExecutonContext().PerTenant("9fd8188e-987f-4977-a813-fab79c719e9c") would decide that not only did we have a new instance of IFoo per execution context, it might be MyFoo for Tenant1 and YourFoo for Tenant2.

We'd obviously need a default implementation for other non-specified tenants.

Maybe something like InstancePerExecutionContext((ec) => //do some check with the execution context); might be a better more generic scope?

┆Issue is synchronized with this Asana task