views:

219

answers:

2

Hi,

I am trying to find out what would be the best way to add logging to a Dynamic Data app? I am using DD for an admin interface and I need to log all the actions the user makes. I thought of adding things to the codebehind of the PageTemplates\ListDetails for example, but was wondering if there is a better way... For data access I am using Entity Framework with Sqlite.

Any help is very much appreciated!

A: 

You can try the Enterprise Library Logging Block.

http://www.codeproject.com/KB/architecture/GetLoggingWithEntLib.aspx

http://msdn.microsoft.com/en-us/library/cc309506.aspx

theG
Hmm, I don't really see how this would help, it's just a logging framework? Or am I missing something? The problem is not in logging, I am using log4net otherwise, it's how and where to instrument DynamicData to be able to log.
Robert Ivanc
A: 

If you want your user info added to the audit trail you could do one of two things:

  1. Use SPROCS in your DB to do CRUD operations and passin the user info
  2. Add business logic in the form of Partial Classes to your model

See links: How to: Execute Business Logic When Saving Changes (Entity Framework) How to Map Stored Procedures using the ADO.NET Entity Framework

Wizzard
thanks! no. 2. idea seems what I was looking for!
Robert Ivanc