Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Last Activity Date - Better Ideas for implementation

For a typical user registration and membership system i follow in ASP.NET website i would like to update the last activity date and time. Which of the below methods would be ideal to follow.

1

Whenever a request is made to a method that access the data from the user account table, automagically(O_o) update the last_account_activity date using GETDATE()

2

Call UpdateLastActivity() as a method external after a method is called from the membership system.

info:

In terms of reliability the #2 is ideal because i can't rely in #1 when user actively using data from other tables rather than user account table.

What do you think? U got another way for me to do it?

Specs

.NET Framework 2.0

Asp.net 2.0

Custom Membership Provider Implementation

Sql Server 2005 Database

like image 723
Deeptechtons Avatar asked Jan 30 '12 12:01

Deeptechtons


2 Answers

Approach 2 is better than 1.

Suggestion

You can do this in Async manner. You just fire the method UpdateLastActivity() and forget about the result. This way performance of your application won't get hampered.

Hope this works for you.

like image 64
Amar Palsapure Avatar answered Sep 20 '22 23:09

Amar Palsapure


It's not very clear how your system is constructed (cause it's actually a root point), but considering that you say that #2 solution is better (from the call paths perspective), I would go for more reliable solution, naturally, unless it doesn't harm performance and not create frustration for my user.

If you're working on DataBase (it's not very clear from the question too), the common approach here is to use triggers bound to the table(s).

like image 20
Tigran Avatar answered Sep 18 '22 23:09

Tigran