Do some work after the response in ASP.NET Core

前端 未结 5 1679
梦如初夏
梦如初夏 2021-02-08 03:31

I have an ASP.NET Core website, using EFCore. I would like to do some work like logging to the database, but after having sent the response to the user in order to answer faster

5条回答
  •  生来不讨喜
    2021-02-08 03:53

    Create a new class that inherits from ActionFilterAttribute, overwrite the OnResultExecuted method to perform the logging and then apply your attribute class to the controller actions you want to do logging.

提交回复
热议问题