public virtual bool TryCreateHandler(IPortalContext portal, out IHttpHandler handler) { if (string.Equals(portal.Entity.LogicalName, "adx_webfile", StringComparison.InvariantCulture)) { if (CloudBlobRedirectHandler.TryGetCloudBlobHandler(portal.Entity, out handler)) { return(true); } var contentNote = portal.ServiceContext.GetNotes(portal.Entity) .OrderByDescending(note => note.GetAttributeValue <DateTime?>("createdon")) .FirstOrDefault(); handler = CreateAnnotationHandler(contentNote, portal.Entity); return(true); } if (string.Equals(portal.Entity.LogicalName, "annotation", StringComparison.InvariantCulture)) { handler = CreateAnnotationHandler(portal.Entity); return(true); } if (string.Equals(portal.Entity.LogicalName, "salesliteratureitem", StringComparison.InvariantCulture)) { handler = CreateSalesAttachmentHandler(portal.Entity); return(true); } handler = null; return(false); }
private bool TryCreateHandler(IPortalContext portal, ContentMap map, out IHttpHandler handler) { switch (portal.Entity.LogicalName) { case "adx_webfile": WebFileNode webfile; if (map.TryGetValue(portal.Entity, out webfile)) { if (CloudBlobRedirectHandler.TryGetCloudBlobHandler(portal.Entity, out handler)) { return(true); } // retrieve the most recently created annotation var note = webfile.Annotations.OrderByDescending(a => a.CreatedOn).FirstOrDefault(); return(TryCreateHandler(note, webfile, portal, out handler)); } break; case "annotation": AnnotationNode annotation; if (map.TryGetValue(portal.Entity, out annotation)) { return(TryCreateHandler(annotation, null, portal, out handler)); } break; } return(base.TryCreateHandler(portal, out handler)); }