-
Notifications
You must be signed in to change notification settings - Fork 12
Add tenant reconfiguration; update locking. #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nt()` for management/reconfiguration of tenants.
|
I really like this! Thanks! Thinking about reconfiguring a tenant and multi-threaded apps. I imagine reconfiguring a tenant on the fly may be like this: mtc.RemoveTenant("tenant1");
mtc.ConfigureTenant("tenant1", b => b.RegisterType<T>());Hypothetically, between I can think of a couple of options to get around this:
What do you think? Is there a fourth option? Or maybe I'm off the deep end, which isn't a far stretch since my current work project has driven me batty. 😆 |
|
Thanks very much. Admittedly, I should have given the atomic-reconfiguration case more thought. Was focused more on the concern of supporting an "admin" side of an application where clients are added or removed as a single operation, not often reconfigured during their lifetime. (For that requirement I have used a less "drastic" mechanism: load all the known implementations of an interface and use Maybe it's just me, but the indeterminate nature of Option 3, Option 1, exposing the lock, only makes sense if there are a multitude of other unforeseeable interactions with the tenant-dictionary, or if we really just want this to be as open as possible. We already have a "start," an "end," and--with the addition of I can't think of any other options either. 🦇, maybe, but pretty cogent 😄 |
…ve-configure fail-case demo; additional caveats in XML docs.
|
Because it proceeds destructively, should it be |
|
Good question. I could see either way, though I lean toward |
|
I'll leave as is, with the appropriate caveats in the XML-docs. |
| /// Removes the tenant configuration and disposes the associated lifetime scope. | ||
| /// </summary> | ||
| /// <param name="tenantId">The id of the tenant to dispose.</param> | ||
| /// <remarks>Like </remarks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's, like, a floating Like here.
| /// Tenant lifetime scopes are immutable, so once they are retrieved, | ||
| /// The ability to remove (<see cref="RemoveTenant(object)"/>) or reconfigure | ||
| /// (<see cref="ReconfigureTenant(object, Action{ContainerBuilder})"/> an | ||
| /// active tenant has been added. However, it must still be noted that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...an active tenant exists." - long term it won't have been added, it just exists.
| /// early, in application startup. | ||
| /// </para> | ||
| /// <para> | ||
| /// Even when using ReconfigureTenant, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReconfigureTenant should be a <see> link to indicate you're referencing a method.
| /// <para> | ||
| /// Even when using ReconfigureTenant, the | ||
| /// existing tenant scope isn't modified, but is disposed and rebuilt. | ||
| /// Any dependencies that were resolved from a Removed scope will also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"removed" should have a lower-case R.
| /// <summary> | ||
| /// Returns whether the given tenantId has been configured. | ||
| /// </summary> | ||
| /// <param name="tenantId">The tenantId to test.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tenant ID
| /// <summary> | ||
| /// Removes the tenant configuration and disposes the associated lifetime scope. | ||
| /// </summary> | ||
| /// <param name="tenantId">The id of the tenant to dispose.</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ID of the tenant" (cap ID)
|
Aight, super minor crap doc updates because I'm a grammar policeman, otherwise ready to go. This is really good stuff. |
|
And, yeah, the grammar police just started a sentence with "aight" which isn't a word. I see the irony there. |
|
Briefly considered appending "Aight, " to the start of some random paragraphs and doing a global replace of "\btenant\b" with "tenet". |
|
YES. THAT. 😆 MOAR MULTI TENETS. |
|
Thank you so much! Very appreciated. I'll set about cutting a .1 release for this in a couple of minutes. |
Remove()allows for reconfiguration of an existing tenant; fixes #5.Changes the locking to use a reader-writer lock.