Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
could someone confirm if this is the correct way to hook up custom logic to document handlers in v4.10
public class SetDefaultsHandler : IApplicationEventHandler { public void OnApplicationInitialized(UmbracoApplication httpApplication, ApplicationContext applicationContext) { //your code here } public void OnApplicationStarting(UmbracoApplication httpApplication, ApplicationContext applicationContext) { //your code here } public void OnApplicationStarted(UmbracoApplication httpApplication, ApplicationContext applicationContext) { //your code here } public SetDefaultsHandler() { Document.New += new Document.NewEventHandler(Document_New); } void Document_New(Document sender, umbraco.cms.businesslogic.NewEventArgs e) { //CODE HERE } }
Nope it isn't, you shouldn't add a constructor.
Move the "Document.New +=" line to the OnApplicationStarting method.
public void OnApplicationStarting(UmbracoApplication httpApplication, ApplicationContext applicationContext) { Document.AfterPublish += DocumentEvents.Document_AfterPublish; Document.AfterSave += DocumentEvents.Document_AfterSave; }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
ApplicationStartupHandler has been deprecated.... in 4.10
could someone confirm if this is the correct way to hook up custom logic to document handlers in v4.10
Nope it isn't, you shouldn't add a constructor.
Move the "Document.New +=" line to the OnApplicationStarting method.
public void OnApplicationStarting(UmbracoApplication httpApplication, ApplicationContext applicationContext) {
Document.AfterPublish += DocumentEvents.Document_AfterPublish;
Document.AfterSave += DocumentEvents.Document_AfterSave;
}
is working on a reply...