public virtual void Process(ModelPropertyContext context) { var url = ((IHtmlString)context.PropertyValue).IfNotNull(x => x.ToHtmlString()); var friendlyUrl = _urlRewriter.GetFriendlyUrl(url, context.ExecutionContext.RequestContext, RouteTable.Routes); context.PropertyValue = HtmlStringActivator.CreateInstance(context.Property.PropertyType, friendlyUrl); }
public virtual void Process(ModelPropertyContext context) { var value = (XhtmlString)context.PropertyValue; var result = new StringBuilder(); using (var writer = new StringWriter(result)) { RenderXhtmlStringToWriter(value, writer, context.ExecutionContext.Controller, context.ExecutionContext.RequestContext ); } context.PropertyValue = HtmlStringActivator.CreateInstance(context.Property.PropertyType, result.ToString()); }