-
Notifications
You must be signed in to change notification settings - Fork 112
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
IFeatureManagerSnapshot one flag, many contexts. #87
Comments
IFeatureManagerSnapshot
one flag, many contexts.
Looks like this is by design :(. Not perfect imo. Here is the code
|
The IFeatureManagerSnapshot is purposefully naïve when it comes to feature contexts. We would need a way to check for equality between contexts to be able to do anything further, and this would've required every context to implement an interface that we provide. This is not always possible so we decided not to impose this limitation. Our thoughts were that in general, if IFeatureManagerSnapshot would be useful in combination with feature contexts, then the lifetime of the feature manager snapshot would be in line with the lifetime of the feature context. |
Another option we have is to allow Object.Equals to play the role of establishing context equality. This may solve the problem. I do want to call out another factor that was considered. Caching an object passed in while evaluating the feature may have unintended consequences since callers might not necessarily be expecting the lifetime of the object to now be tied to the snapshot. It's something we'd want to consider if we did take the approach I just mentioned. |
Thanks @jimmyca15, I guess that is fair enough. It would be great so see a bit more sophistication in how the manager operates, but I suppose I can live with it the way it is now. I did experiment with |
Probably it's more a question than an issue (I hope), but is this expected behavior?
Context:
I'm evaluating one flag for two different contexts:
123
456
The flag should only return
true
for context123
.(where
_featureManagerSnapshot
is of typeIFeatureManagerSnapshot
)returns:
FeatureVFor123: true. FeatureVFor456: true.
Which I would not expect (it's a different set of conditions for the flag). I would expect:
FeatureVFor123: true. FeatureVFor456: false.
It looks like the evaluated flag is getting cached and subsequent evaluations are ignoring different contexts. It does work correctly when I use
IFeatureManager _featureManager
.Is this by design?
The text was updated successfully, but these errors were encountered: