Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Change IValueProviderFactory.GetValueProvider to be synchronous. #528

Closed
wants to merge 1 commit into from

Conversation

pranavkm
Copy link
Contributor

Follow up to #303

.ToArray();

return new ActionBindingContext(
var valueProviders = _valueProviderFactories.Select(factory => factory.GetValueProvider(requestContext))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to the ToArray here? Seems like that's a good thing to have since we don't want to call the factories multiple times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the CompositeValueProvider be replaced? In WebAPI we had the AsArray construct, that wouldn't force a copy, but will ensure that if the input is not an array it will do it then. Thus reducing the dependency/coupling of the two classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can always consume it as an IEnumerable though and AsArray seems like a premature perf optimization.

@JaneZhouQ JaneZhouQ modified the milestone: Post Alpha May 13, 2014
@kanchanm kanchanm modified the milestones: Alpha, Post Alpha May 14, 2014
@pranavkm
Copy link
Contributor Author

bump

}

private PrefixContainer PrefixContainer
public CultureInfo Culture
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider just a field here is this doesn't need to be exposed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure why this was ever a public property actually. If there's a good reason then just ignore my ill-informed-raving.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. I think it's just a convenience thing so you know what Culture your instance of ReadableString... is using

@rynowak
Copy link
Member

rynowak commented May 19, 2014

:shipit:

@@ -29,14 +29,12 @@ public class DefaultActionBindingContextProvider : IActionBindingContextProvider
_validatorProviders = validatorProviders;
}

public async Task<ActionBindingContext> GetActionBindingContextAsync(ActionContext actionContext)
public Task<ActionBindingContext> GetActionBindingContextAsync(ActionContext actionContext)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will not return a faulted task when something fails along the way. Did you verify the behavior is still fine upstream when a failure happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the context provider also needs to be sync. That said the type itself might need some redesign now that we have support for scoped services which was primarily what we designed this for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yishaigalatzer Thoughts?

@pranavkm pranavkm closed this May 27, 2014
@pranavkm pranavkm deleted the ProviderSync branch May 27, 2014 21:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants