1

I have some misunderstandings about the implementation of an SQL audit module, using as ORM Fluent NHibernate. So here is the situation:

We are talking about a Client-Server application build on MVC3 framework. Suppose there we have a method which renders the grid:

[HttpGet]
public ActionResult ShowGrid()
{
   var gridModel = _gridService.GetAllRecords();
   return View(gridModel);
}

Now when somebody executes a DB Inser/Update/Delete command, I want that every client which views that grid to see that there are some changes inside.

I have 3 ideas:

1) To write a script that makes a refresh by calling the database, each X seconds. Making a full Select even if there are no changes yet. Worst decision

2) To create some sort of trigger, which updates a custom audit table, and then to check if there is some new data, by comparing some Object State/ LastUpdate fields. Better

3) To use some other tools (no have ideea what tools), that will offer some solutions.

If somebody have some information, maybe there already exists a solution please share. Thank you very much!

1 Answer 1

2

Using NHibernate, the easiest way:

NHibernate Interceptor

If you need implement something more complex you can mix it with event listeners:

Here

Or use:

NHibernate.Envers

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

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.