本文整理汇总了C#中IController.Recycle方法的典型用法代码示例。如果您正苦于以下问题:C# IController.Recycle方法的具体用法?C# IController.Recycle怎么用?C# IController.Recycle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IController
的用法示例。
在下文中一共展示了IController.Recycle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReturnController
/// <summary>
/// Prepares the controller for a new lifecycle.
/// </summary>
/// <param name="controller">The controller.</param>
/// <param name="context">The http context for the current request.</param>
/// <param name="requestContext"></param>
public virtual void ReturnController(IController controller, HttpContextBase context, IContext requestContext)
{
// populate outbound values
foreach (string cookie in descriptor.CookieFields.Keys)
if (descriptor.CookieFields[cookie].Outbound)
{
HttpCookie newCookie = context.Response.Cookies[cookie] ?? new HttpCookie(cookie);
var val = GetValue(controller, descriptor.CookieFields[cookie].Field);
if (val != null)
newCookie.Value = Convert.ToString(val);
newCookie.Expires = val == null ? DateTime.MinValue : DateTime.MaxValue;
context.Response.Cookies.Add(newCookie);
}
foreach (string requestField in descriptor.RequestFields.Keys)
requestContext[requestField] = GetValue(controller, descriptor.RequestFields[requestField]);
foreach (string sessionField in descriptor.SessionFields.Keys)
context.Session[sessionField] = GetValue(controller, descriptor.SessionFields[sessionField]);
controller.Recycle();
foreach (MemberInfo info in manipulatedFields)
SetValue(controller, info, null);
}