LastAccessTime CSLA Business Rule Implementation Question #3429
-
We have requirement to update a LastAccessTime field in our User table every time a user does something on our app. So, using CSLA, what approach would you suggest implementing this business rule? Would you just create a LastAccessTimeRule and attach it to ALL business classes and then use a Command object to update the time? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I guess it depends on what triggers "access" - is it logging in, reading data, altering data? Yes, I'd use a command pattern to do the update. If the frequency of updating the last access time is high (like multiple times a second per user) then I'd consider using a queue to buffer those messages - possibly even writing some code in the queue listener to more efficiently update the database - blindly updating that field many times per second per user could be a problem! You could use a rule as you suggest. If "last access" is based on a data portal operation, you might use a server-side authorization hook or interceptor hook (v6 or higher) in the data portal to update without complicating business rules at all. |
Beta Was this translation helpful? Give feedback.
I guess it depends on what triggers "access" - is it logging in, reading data, altering data?
Yes, I'd use a command pattern to do the update. If the frequency of updating the last access time is high (like multiple times a second per user) then I'd consider using a queue to buffer those messages - possibly even writing some code in the queue listener to more efficiently update the database - blindly updating that field many times per second per user could be a problem!
You could use a rule as you suggest. If "last access" is based on a data portal operation, you might use a server-side authorization hook or interceptor hook (v6 or higher) in the data portal to update without complicating…