I think I figured it out. It looks like the issue is that VaryByParam, when the input parameter is an object, uses ToString() on that object to determine it's uniqueness. So this leaves two options: Overriding ToString() to provide a unique identifier Passing a unique identifier as an additional parameter: % Html.
RenderAction("RenderContent", Model, Model. Id); %> Authorize OutputCache(Duration = 6000, VaryByParam = "id", VaryByCustom = "browser") public ActionResult RenderContent(Content content, string id) { return PartialView(content); }.
I think I figured it out. It looks like the issue is that VaryByParam, when the input parameter is an object, uses ToString() on that object to determine it's uniqueness. So this leaves two options: Overriding ToString() to provide a unique identifier.
Passing a unique identifier as an additional parameter: Authorize OutputCache(Duration = 6000, VaryByParam = "id", VaryByCustom = "browser") public ActionResult RenderContent(Content content, string id) { return PartialView(content); }.
Great answer, just what we needed. We used option 1. Using return GetHashCode().ToString(); in the public override string ToString() to create a unique code for each object.
This seem to work fine. – Tom Styles Sep 6 at 13:00.
I think I figured it out. It looks like the issue is that VaryByParam, when the input parameter is an object, uses ToString() on that object to determine it's uniqueness. So this leaves two options.
Mainly because they are reusing an attribute that works in one situation honoring all of the properties and config settings, and then in the child action scenario just ignoring all of those settings and only allowing VaryByParam and Duration. How one would go about figuring out what is supported is beyond me. I'm not sure why this isn't called out in documentation, but even if it was the api should make it clear, or at least throw the right exception.
In short, partial output caching works, BUTT not like you would want it too. I'll work on fixing the code and honoring some of the settings like enabled. I fixed the current implemenation to at least work for my situation with respecting the enabled flag and allowing cache profiles from the web.config.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.