-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
YesSqlOptions and DbConnectionValidator concerns. #12657
Comments
@jtkech currently the When we validate a new tenant, then we use the current global value as we should since this global configuration is for defaults. I think the problem with the
Additionally, I think we should also provide a a new TableNameConbvention for OC so that it uses the Now, when we validate new tenant from |
Okay, feel free to start a PR around this when you will have time. Only from memory so in an unordered way.
I removed it at the time I was assuming that YesSqlOptions should be for all tenants and should have the same values for the lifetime of a given application. Hmm, when you say options may be different per tenant, did you mean that in fact the options are always provided in the same way for all tenants, e.g. from an always enabled feature or from the app with our ConfigureServices() helper, and then that different tenants may have different values only because when they are setup the options values were different. So meaning no different options per tenant at a given time, only one global way for all tenants but that may provide different values in the lifetime of the app. If so that would be more reasonable, okay they would provide default values when creating/setup a tenant, and these default values may change e.g. to create/setup new tenants.
Okay then for the case of new tenants
Yes, I don't assume this as I'm using it in the TenantRemoval PR before removing a tenant, we already use it when saving and before setup a tenant, hmm but here maybe you mean by new tenant a tenant that is not yet setup, anyway I agree. Yes good idea to use a Yes I know for the new Yes need to be sure of what we want, and then document it accordingly. So okay, If I understood correctly the above, at this point still a problem for the options that are related to implementations, knowing if I remeber correctly that only
Okay, do you mean only one static way to implement If so okay, the simple options would be hold by ShellSettings, the only implementation needed by But maybe I completely misunderstood what you meant ;) |
It may be easier to explain it via code. But the idea when you validate when adding/setting up a tenant, you provide the values to the validator from the global option. However, when removing a tenant, you want to pass values from current ISession or the ShellSetting. We cannot assume that the setting will not change thought the life of the application which is why I stored the separator in the ShellSettings. Not sure why that was removed, but I think it should be put back. If the ShellSettings does not have a value (null), we assume the hard coded I'll try to submit a PR to hopefully explain it better. |
Okay so I think we now are more in sync on what may have to be done.
Okay then, so it seems that I understood what you meant in my previous comment
Which is not the same as having But now that
I did it because of the above
I now agree but see in the below section what we already support out of the box.
Yes less easy to manage when coming from configuration, but if only from options it is easier. So okay looks like we are better in sync but see the following. That said, what you have to know is that So So just to say that all So for these simple fields, as suggested at some point we could just say that they are configurable through regular config sources. For example if the default separator is not configured we could use the default of the default which would be the underscore used by yesSql by default. So This way we could retrieve the configured (or not) value of a given tenant before the related container is built, at least without having to create a scope on it. |
Additionally, I think new tenant screen should have the options where the admin can provide a schema, separator, identity column type. All this would be saved in the ShellSettings as previously mentioned. By default, these fields will come from the YesSqlOptions |
First let's talk about only fields that can be held by
Okay no problem but before the problem was for the needed
I don't think so, now that these simple fields will be managed through For example we already can pre-configure the So for example About the other options being implementations, here also we would need to ensure that we resolve the same values for a given existing tenant, knowing that for now these options can't be held by Will see later and then add to the documentation what people can do. About the identity column type, we have services as |
So when you validating a new tenant, you can create When you validating the connection before the setup and when you configuring the connection When you remove the tenant,
In summary, I think all the properties should be stored in the |
You don't need this as we already can configure them from any config source, e.g. the main appsettings.json, doing so you will see them when first editing a tenant, then when updating the tenant specific appsettings it will always win. Updated: The same way we don't need to provide a Step by step, I will read your other comments. |
|
That can be provided from Configuration |
If nothing is configured to provide default values, you just need to apply default of the default values. As you do in YesSql options through a property initializer (the default of the default) if nothing is set afterwards. |
That's another concern, if so we can document it to not do it, then would have to be managed a little differently, maybe only its initial value or yes keep it in YesSql options, anyway it is already possible and at the end it will be e.g. in the tenant specific appsettings.json which is a config source. |
I'm not against keeping YesSql options for these fields but they can already come from configuration, so if at some point you check if ShellSettings already contains a value for a given option it may have already came from configuration. That said maybe we just need to don't say to people that they can do this ;) |
Just saw your About other implementation options, how did you plan to configure them, in a fixed way, globally or per tenant? |
@jtkech the TableConvention would be per tenant during the configuration of the sqlserver and then registered "I think we already register it as a service" |
Okay for To anticipate, the question was more related to other implementations as |
Seems I will lose in the long discussion ;) talking with code could simply the things |
@hishamco Don't worry I'm going to close this thread ;) @MikeAlhayek Okay, I think it was good to be aware of what is provided oob from Configuration, but yes not so easy to anticipate what would be static in OC, which options are global or not, not good to be provided from configuration, so I'm not against using YesSqlOptions as a first source of default values. So feel free to open a PR to provide what you want and that you know better than me, maybe at least even if it is editable or not, set from the beginning the separator in ShellSettings, and then even if the first default value doesn't come from Configuration but YesSqlOptions, anyway when the ShellSettings will be saved in the tenant specific appsettings, it will be part of the configuration stack. So that's okay, normally we will be able to retrieve the separator from ShellSettings without having to create a scope, so maybe I will not have to change anything in the Tenant Removal PR. Then add what is needed around the fixed Yes because here still not clear for me, okay About how other implementation options are intended to be used, I don't have enough info, at least for now they can't be held by ShellSettings, so maybe at least they should be global for all tenants. So the code could be kept as is, just to know if we agree on this, and if so we could document it, e.g. that they should not rely on a feature that may be deactivated. Anyway I will close this issue and will see the last details if you open a new PR. |
Did you see my previous comment where I suggest to open a new PR and another issue as this one is already too long, at least to fix the current known issue if the |
@jtkech yes. I saw the comment. I am planning to start a PR, but won't be soon. If you want to start PR go for it. Anyway, whom even starts a PR first, please draft it so we have one PR instead of multiple |
Okay cool then, will see. |
@jtkech I created and branch and started to make some updates toward this. Nothing to share yet more to know that I started. I'll draft a PR after a have some to share probably tomorrow. If you have started PR, feel free to continue and at then end we can compare the approaches and see which one would fit better |
In your connection string try to add Encrypt=false or TrustServerCertificate=True See #12653 |
Thanks, But I haven't set this option in most programs, : / |
Okay will look at it this night |
YesSqlOptions
may have different values per tenant, but we use it inDbConnectionValidator
on a shell that is not yet built so the.ValidateAsync()
may use wrong values.I thought about only using configuration to be able to retrieve the config section of a tenant before it is built, but
YesSqlOptions
not only contains simple fields but also implementations asTableNameConvention
.I started a PR using
IConfigureNamedOptions<YesSqlOptions>
providing options by tenant name but there is another concern if we upgrade the code on an existing application, see below.When building an existing tenant we should not use
YesSqlOptions
but the actual values that was used to create, update or setup the tenant. On an existing application if you do the following as documented, you get again the setup screen.No problem for e.g.
TablePrefix
that is selectable and then hold byShellSettings
but for options coming fromYesSqlOptions
asTablePrefixSeparator
this is not yet the case.Not a big issue, we could also hold all
YesSqlOptions
onShellSettings
, butYesSqlOptions
not only contains simple fields but also implementations asTableNameConvention
.There are solutions, maybe some providers activating implementations by type names, notice that this would also allow to configure all
YesSqlOptions
from configuration sources.I can work on it but first I prefer to be sure of what we want.
The text was updated successfully, but these errors were encountered: