3

Closed

Add ITempDataProviderFactory helping to create new instance per controller in Controller.CreateTempDataProvider().

description

This is a subsequent issue separated from WorkItem #1692: [Using DependencyResolver with ITempDataProvider/IActionInvoker the resolved instances are only created once and then shared], in which only Controller.CreateActionInvoker() is fixed. Should we make a similar fix applied to Controller.CreateTempDataProvider()?


Although ITempDataProvider is already like a factory producing a data dictionary. According to this, some IoC containers, such as Ninject, may offer options to set the life span of a service's instance:
kernel.Bind<ITempDataProvider>()
    .To<RedisTempDataProvider>()
    .InRequestScope();
So the user may still consider it as a bug.
Closed Apr 8 at 12:41 AM by Mugdhak
Verified fixed

comments

TheCloudlessSky wrote Mar 7 at 12:38 AM

+1 to fix this similar to how you did it with the IActionInvoker. Also +1 for updating the documentation on the Resolver.

TheCloudlessSky wrote Mar 7 at 1:10 AM

I have created a pull request that fixes this.

TianPan wrote Mar 19 at 1:12 AM

Hello @TheCloudlessSky,

It seems that we cannot accept your pull request for LCA and minor differences from our expectation, though your contributions are highly appreciated. (You can see it is pending there for a long time... Unfortunately, I do not have the right to accept it.)

It is not fix in 28ad38057a178afae600fcc79017b1ebb7222a33.

Thanks,
Tian

TheCloudlessSky wrote Apr 3 at 1:04 AM

Hi Tian,

Sorry I didn't reply earlier. what do you mean by "LCA" and "minor differences from out expectation"? It seems the fix you made and the fix I made were identical?

Thanks!

TianPan wrote Apr 3 at 3:19 AM

Hello TheCloudlessSky,

Can you take a look at https://aspnetwebstack.codeplex.com/wikipage?title=Contributing, which says:
You will need to sign a Contributor License Agreement before submitting your pull request. To complete the Contributor License Agreement (CLA), you will need to submit a request via the form and then electronically sign the Contributor License Agreement when you receive the email containing the link to the document. This needs to only be done once for any Microsoft Open Technologies OSS project.
And the minor differences are
  • The comment should say the factory is intended for the controller instead of the request.
  • The unit test should ensure the order that we try with ITempDataProviderFactory first and then try with ITempDataProvider .
Best,
Tian