public void WriteNode(IMediaNode node, IHttpRequest request, IChainResolver resolver) { var chain = Finder(resolver) as RoutedChain; if (chain == null) { throw new Exception("Unable to find a routed chain for a Javascript route named " + Name); } node.SetAttribute("name", Name); node.SetAttribute("method", Method); node.SetAttribute("url", request.ToFullUrl(chain.GetRoutePattern())); if (chain.Route.Input != null) node.SetAttribute("params", chain.Route.Input.RouteParameters.Select(x => x.Name).ToArray()); }
public void Project <T>(IProjectionContext <T> context, IMediaNode childNode, IMediaNode parentNode, string nodeName) { var connegGraph = context.Service <ConnegSettings>().Graph; var projectionType = connegGraph.WriterTypesFor(typeof(TValue)) .FirstOrDefault(x => x.CanBeCastTo <IProjection <TValue> >() && x.IsConcreteWithDefaultCtor()); var childContext = context.ContextFor(_value); if (projectionType == null) { parentNode.SetAttribute(nodeName, _value); } else { var projection = Activator.CreateInstance(projectionType).As <IProjection <TValue> >(); projection.Write(childContext, childNode); } }
public void WriteValue(IValues <T> target, IMediaNode node) { var value = target.ValueFor(_accessor); node.SetAttribute(Name(), value); }
public void Write(IProjectionContext <T> context, IMediaNode node) { var value = Source(context); node.SetAttribute(AttributeName, value); }
public void Write(IProjectionContext <T> context, IMediaNode node) { node.SetAttribute(attributeName, source(context)); }