Feature/status resolution - #608
Conversation
interface and implementation Closes microsoft#604
di setup ext method Closes microsoft#604
status resolution tests Closes microsoft#604
added comments Closes microsoft#604
|
Hello Zhiyuan Liang (@zhiyuanliang-ms) ! It's been a little while. Could you take a look at my proposal of the FeatureServiceProvider API please? |
|
Hey, Степан (@Stepami) Sorry for the late response. I actually discussed this with my colleague. We came up with the following design: Introduce a new overload The This is very similar to your proposal. But the benefit is that we don't need to introduce a new API with a new name and people can keep using What do you think? |
Zhiyuan Liang (@zhiyuanliang-ms)
|
|
Are you referring to the lack of a way to pass the filter context in as a parameter to resolve the service? That does seem like a deficiency of IVariantServiceProvider. We can consider how to address it. |
|
Hey, Степан (@Stepami)
This is a good call. We missed this for variant evaluation as well. ValueTask GetVariantAsync(string feature, ITargetingContext context, CancellationToken cancellationToken = default) This makes thing tricky. It will be clean if we can add a new My current thought is that we can introduce a new public interface IContextualVariantServiceProvider<TService> where TService : class
{
ValueTask<TService> GetServiceAsync<TContext>(TContext context, CancellationToken cancellationToken);
}We will have the current |
|
Jimmy Campbell (@jimmyca15) yes i am! Zhiyuan Liang (@zhiyuanliang-ms) did a great job of explaining my point. However, i still do not understand why status based resolution should be bound to variant evaluation |
Hey, Степан (@Stepami) |
|
Zhiyuan Liang (@zhiyuanliang-ms) thanks, i got your point. Why is addding a new |
Hey, Степан (@Stepami)
|
|
hey, Zhiyuan Liang (@zhiyuanliang-ms)
That's a good call. Well, there are not many options left. If your goal is to have as little new API as possible, then The next question i would ask is whether this interface extends
IMHO the only way it works is opposite - non-generic method calls |
|
Hey, Степан (@Stepami)
Yes,
I mean: adding a new method for an existing interface with a default implementation to avoid break change. But since we have aligned with introducing
I agree. |
|
Hey, Степан (@Stepami) I sent out PR #611 to implement the proposed design. |
Why this PR?
Closes #604
Visible Changes
IFeatureServiceProvider<TService>interface to get the implementation based on the feature status, maybe using additional contextWithFeatureService<TService, TEnabled, TDisabled>extension method to setup feature service provider in diFeatureServiceProviderOptionsclass that specifies the keys used by a feature service provider to resolve an implementation based on the feature flag status when keyed di is available.