-
Hey! Might this the issue? My implementation on the public void Configure(
IApplicationBuilder app,
IWebHostEnvironment env,
IApi api,
LogContext logContext,
UserResolverService userResolverService) {
// ...
App.Init(api);
// ...
App.Hooks.Pages.RegisterOnAfterSave((page) => {
logContext.Logs.Add(new LogChangeModel() {
Id = page.Id.ToString(),
Title = page.Title,
Snapshot = JsonSerializer.Serialize(page),
User = userResolverService.GetUser(),
ChangeTime = DateTime.Now
});
logContext.Logs.SaveChanges();
}
// ...
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The problem is that the context you’re using in the hook will be disposed as soon as the Configure method is done, you need to resolve the context inside the hook itself. See this SO answer for reference! https://stackoverflow.com/a/65631856/1793832 Best regards |
Beta Was this translation helpful? Give feedback.
The problem is that the context you’re using in the hook will be disposed as soon as the Configure method is done, you need to resolve the context inside the hook itself.
See this SO answer for reference! https://stackoverflow.com/a/65631856/1793832
Best regards