Reputation: 8415
there is a logging class that logs user activities into a database .
as I didn't wanted to write logging codes in all methods ( violating SRP principle if I'm not wrong ) , I decided to define events and raise them in methods .
then add a class that contains event handling methods to subscribe to events and use logging class to log necessary data into database.
another point is that during a request several events may raise and I want to catch them all and add logs to the database in one transaction .
now I wonder where and how should I instantiate this handling class to achieve this goal ?
I'm using Asp.net WebForms
.
Upvotes: 1
Views: 167