public void Format(IPaperContext context, IObjectFactory factory, Entity entity) { // TODO: deveriamos consultar o catalogo // var paperCatalog = factory.GetInstance<IPaperCatalog>(); // paperCatalog.FindByType(typeof(TPaper)); var paper = (IPaper)Activator.CreateInstance(paperType); var paperDescriptor = new PaperDescriptor(paper); var href = paperDescriptor.PathTemplate.Substring(1); if (paperArgs != null) { foreach (var arg in paperArgs) { var value = Change.To <string>(arg); href = Regex.Replace(href, @"\{[^{}]+\}", value); } } if (Rel?.Any() != true) { this.AddRel(RelNames.Link); } this.Href = href; }
public void Format(IPaperContext context, IObjectFactory factory, Entity entity) { if (Rel?.Any() != true) { this.AddRel(RelNames.Link); } }