D
D
DavyJohnes2014-03-30 15:13:49
ASP.NET
DavyJohnes, 2014-03-30 15:13:49

How to track the occurrence of events in an object?

Let's say we have an instance of some class. There are definitely a lot of events in this class. I want to see the history of the occurrence of these events in the course of the program. I would like to see something like

16:45:15 Obj1.onEvent1
16:45:16 Obj1.onEvent2
16:45:17 Obj1.onEvent3
16:45:18 Obj1.onEvent2
16:45:19 Obj1.onEvent4

Is this possible in VisualStudio 2012 Ultimate?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vladmir-boy, 2014-03-30
@vladmir-boy

I haven't tried it, but
www.postsharp.net/aspects/intercept-event
In general, all events that have subscriptions can be processed by the standard logging aspect. all events for which subscription is optional can be moved to the base abstract class and the handlers can be made virtual and implemented as empty ones.
In general, the task of logging events is no different from the task of logging method calls. This is where the concept of aspect-oriented programming comes into play.
en.wikipedia.org/wiki/%D0%90%D1%81%D0%BF%D0%B5%D0%...
hope it helps.
Free AOP frameworks are also enough, but they have slightly different principles of work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question