AuditRecord class problems.

Apr 1, 2009 at 5:19 PM
In your instructions for InsertAuditRecordToDatabase() in the partial DataContext class, you use an AuditRecord instance.  I can't find this class in your library.  Am I missing something?
Apr 2, 2009 at 9:06 PM
In addition to the AuditRecord class, I'm having an issue where every time I update my DBL layout I get a compile error saying that the InsertAuditRecordToDatabase override cannot find a suitable method.  It's as though my DataContext class forgets which base class it's inheriting.  Has anybody else had this issue?
Oct 9, 2009 at 9:55 PM
CoderHead wrote:
In addition to the AuditRecord class, I'm having an issue where every time I update my DBL layout I get a compile error saying that the InsertAuditRecordToDatabase override cannot find a suitable method.  It's as though my DataContext class forgets which base class it's inheriting.  Has anybody else had this issue?

I know this post is really old but I was wondering if you ever solved this problem. We are looking to use Doddle in a production application but can't get past this issue. Thanks!

 

Oct 12, 2009 at 12:52 PM
bkbroughton wrote:
I know this post is really old but I was wondering if you ever solved this problem. We are looking to use Doddle in a production application but can't get past this issue. Thanks!

No, I've found no solution to this problem.  Since there's been no help with this, I've scrapped DoddleAudit for now.  Sorry.

Oct 12, 2009 at 1:42 PM
coderhead wrote:
bkbroughton wrote:
I know this post is really old but I was wondering if you ever solved this problem. We are looking to use Doddle in a production application but can't get past this issue. Thanks!

No, I've found no solution to this problem.  Since there's been no help with this, I've scrapped DoddleAudit for now.  Sorry.

I was afraid of that. Did you find another auditing solution that works with L2S?

Thanks!

 

 

Oct 12, 2009 at 1:51 PM

Nope. I'll probably try to find something once I have all of the core features written and tested. Maybe auditing will have to be a 1.1 release.

Coordinator
Oct 12, 2009 at 2:45 PM

I apologize for the delays, and lack of activity on this project recently. Regarding the issues above, it looks like my instructions were not updated with the most recent API changes. 

I have not packaged up the source for a new point release in quite a while (as I'm sure you've noticed), but at this time I would recommend getting the latest version from the Source Code tab above.

 

To answer the specific question in this thread, the AuditRecord class has been renamed to AuditedEntity -- which has a collection of AuditedEntityFields to see which fields were modified in the audit.

Please let me know if that helps. I am going to try to commit to updating DoddleAudit to a 1.0 release very soon (including the EF support) which has been added in the latest source code release as well.

 

-Matt

 

Oct 12, 2009 at 4:31 PM
mhidinger wrote:

I apologize for the delays, and lack of activity on this project recently. Regarding the issues above, it looks like my instructions were not updated with the most recent API changes. 

I have not packaged up the source for a new point release in quite a while (as I'm sure you've noticed), but at this time I would recommend getting the latest version from the Source Code tab above.

 

To answer the specific question in this thread, the AuditRecord class has been renamed to AuditedEntity -- which has a collection of AuditedEntityFields to see which fields were modified in the audit.

Please let me know if that helps. I am going to try to commit to updating DoddleAudit to a 1.0 release very soon (including the EF support) which has been added in the latest source code release as well.

 

-Matt

 

Matt,

Thanks for pointing out the newer source code. I have downloaded it and the compile errors that I was experiencing every time I added a new entity have gone away.

However, I'm now confused as to what the InsertAuditRecordToDatabase() and DefaultAuditDefinitions() methods should look like. For example, for DefaultAuditDefinitions(), there no longer appears to be an Audit() method on entities collections (i.e. this.Projects.Audit() no longer works). Would you mind posting new sample code for both of these methods?

I really do appreciate the work you have put into this.

Thank you,

Brian

 

 

Coordinator
Nov 4, 2009 at 2:54 PM

Hi Brian,

Were you able to solve this issue? The methods were renamed in the latest source code but they serve the same purpose. You are free to leave DefaultAuditDefinitions() empty if you wish, it's just a place to centrally define all your audit definitions that will be automatically applied during any data context changes.

InsertAuditRecordToDatabase is where you take the AuditedEntity properties and persist it into your database in any way of your choosing. Since DoddleAudit does not mandate the storage schema of the audited records this is where you will "map" that code to your database and store it.

Please let me know if that doesn't explain it very well.

-Matt

Nov 4, 2009 at 3:03 PM

Hi Matt,

Yes, I did get this issue resolved. I meant to go back and update my comments but forgot to. We are moving forward with our plans of using your audit solution. Thanks for sharing your hard work with the rest of us!

Thanks again,

Brian

From: mhidinger [mailto:notifications@codeplex.com]
Sent: Wednesday, November 04, 2009 9:55 AM
To: Broughton, Brian K (HAS-SAT)
Subject: Re: AuditRecord class problems. [DoddleAudit:51988]

From: mhidinger

Hi Brian,

Were you able to solve this issue? The methods were renamed in the latest source code but they serve the same purpose. You are free to leave DefaultAuditDefinitions() empty if you wish, it's just a place to centrally define all your audit definitions that will be automatically applied during any data context changes.

InsertAuditRecordToDatabase is where you take the AuditedEntity properties and persist it into your database in any way of your choosing. Since DoddleAudit does not mandate the storage schema of the audited records this is where you will "map" that code to your database and store it.

Please let me know if that doesn't explain it very well.

-Matt

Read the full discussion online.

To add a post to this discussion, reply to this email (DoddleAudit@discussions.codeplex.com)

To start a new discussion for this project, email DoddleAudit@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Apr 16, 2010 at 1:07 AM
Edited Apr 16, 2010 at 1:11 AM

I'm having the same issue Brian had. I'm confused as to what InsertAuditRecordToDatabase() should look like. I've followed the conversation, downloaded the latest source code, modified the example to match all the new method/type names that I could figure out, but I'm still stuck.

I'm hoping it'll all fall into place if someone could point out what the following line from the example should be changed to:

this.AuditRecords.InsertOnSubmit(audit);

Thanks,

-Mark

Coordinator
Apr 16, 2010 at 1:14 AM

mlapierre,

When you override InsertAuditRecordToDatabase() you can put any code that you want to put inside the method body.

DoddleAudit does not force you to store audit records in any way, it simply calls this method every time an entity is changed, passes you an object that you can inspect to figure out which table was modified, by who, when, and which properties changed. What you do with this information is up to you.

On the home page I have some sample where where I use the Datacontext to store the AuditedEntity data into 2 tables that I created in my database -- you can free to use that same schema that I used in that sample, or create your own storage mechanism. The thing to keep in mind is that DoddleAudit will call InsertAuditRecordToDatabase for you automatically, and you choose what you want to do with that information.

 

-Matt

 

 

 

Apr 16, 2010 at 1:21 AM

Thanks Matt. I think I just need some more sleep - It completely escaped me that I hadn't added the AuditRecords table to the DBML. *headdesk*

 

Sep 21, 2010 at 2:57 PM

 

In your instructions for InsertAuditRecordToDatabase() in the partial DataContext class, you use an AuditRecordinstance.  I can't find this class in your library.  Am I missing something? if u have any idea pls mail to gopikishan.may9@gmail.com

Feb 1, 2011 at 3:02 PM

If you're using the latest source and Entity Framework, there's some modification to be done for the Tests project to compile. For InsertAuditRecordToDatabase() to work in the NorthwindEntities class, you need to first change the base class from ObjectContext to Audit.Entity.AuditableObjectContext in the <Container>.Designer.cs file. Linq2SQL gives you a base class property in the designer and you'd want the Audit.LinqToSql.AuditableDataContext class in that instance.

AuditRecord here matches the base table for audits and is typically what you define in your own .edmx or .dbml file. If you use CreateAuditTables.sql, it would be AuditRecords but it could be whatever you define.