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 @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? |
|
|
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 |
|
@jimmyca15 yes i am! @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 |
|
@zhiyuanliang-ms thanks, i got your point. Why is addding a new |
Hey, @Stepami
|
|
hey, @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. |
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.