1

I want to implement event management in my application and i wanna know what may be the best practice to achieve this goal. Event management in my case is to maintain a log of every insert/update/delete operation in my application.

2
  • 1
    Edited your title. "Event management" is pretty vague. Commented Jul 2, 2010 at 13:08
  • 1
    What detail level do you want? Every detail of every change, or just a generic "UserX edited ItemY at 2010-07-02T08:32:44"? Commented Jul 2, 2010 at 13:34

4 Answers 4

3

It sounds like you are refering to a database event, in that case i would use triggers on the db and not bother with any ASP.Net implementation.

Sign up to request clarification or add additional context in comments.

1 Comment

I'd agree it's normally safer to have them at the DB level so that modifications outside the application are also caught and logged. Also assuming that you want to log the events to the database.
1

What data access layer are you using? If you're using LINQ to SQL or Entity Framework you could hook into events in their contexts to track these operations. Or, if you have a service tier through which these operations all flow, you could raise events there.

Specifically, since you are using LINQ to SQL, then you can implement the partial methods InsertEntity, UpdateEntity, and DeleteEntity (where Entity is the name of each of your entities) on your strongly-typed DataContext. These hooks should be the exact place to perform your logging or other event processing.

Comments

1

Use Change Data Capture http://www.mssqltips.com/tip.asp?tip=1474

Comments

0

I agree with the answer that it can be done in the DB layer by using triggers. If you don't want to put it in the db layer, you can create an action filter for all of your actions (add/update/delete) - which writes to the log.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.