This is a migrated thread and some comments may be shown as answers.

simple CUD audit trail?

6 Answers 128 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David Avery
Top achievements
Rank 1
David Avery asked on 14 Dec 2011, 05:55 PM
Hey guys

I see a lot of functionality here, but my very simple "already in production" CRUD methodology already has a built in audit.  It journals all changes and optionally all accesses.\

I am using vb.net, is there a simple way I can log to my table each changed value?  I think this is a pretty common requirement for secure systems, worthy of some sort of tech note.  I did read about profiling and stuff, but I think it would take me quite a while to make something functional, and my hope was that you already had something that was something we could just add in.


Something like this below
AuditID
AuditPrevValue
AuditNewValue
AuditTypeID (0=access, 1=insert, 2=update, 3=delete)
TableName
KeyFieldValueString
UserID
UserIP
AuditDatetime

Thanks

6 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 15 Dec 2011, 07:47 AM
Hi David,

One way of doing so is to use the Lifecycle events described here.

It is in the classic API I know... what I don't know is if this has been made available in the new API (Context / Visual designer). Anyone from Telerik to elaborate on this?

Update:
As for the Context API there is also a chance to inspect the changes done before the commit, Described here

Regards

Henrik
0
PetarP
Telerik team
answered on 19 Dec 2011, 03:58 PM
Hello Henrik and David,

 Yes, the Lifecycle events are indeed part of the old API. It is possible that this api is Exposed through the IObjectScope instance bound to the OpenAccessContext so it is still possible to use it. Note that we are going to move that API to the context as well in one of our next releases.

Greetings,
Petar
the Telerik team

Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
David Avery
Top achievements
Rank 1
answered on 22 Dec 2011, 06:31 PM
Hi Petar

Hmm, not sure I understand what you are saying - there is a way, but it is an "old" interface?  What's the right way to do it, with the ORM as it exists right now?  I don’t want to use an ORM that doesn't have a way to get this done.  Also, I would think that a sample would be of great use, can you point me to a sample audit implementation, or perhaps create one for the code library?
0
PetarP
Telerik team
answered on 23 Dec 2011, 03:44 PM
Hello David,

 While it is in the old way it is still accessible and will always be via the underlying IObjectScope. You can create a partial class to your context class and add this method there:

internal IObjectScope Scope
        {
            get
            {
                return this.GetScope();
            }
        }
This will expose the IObjectScope as a property on the context and you will be able to take advantage of our Lifecycle events as Henrik already mentioned.
Hope that helps.

Regards,
Petar
the Telerik team

Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
David Avery
Top achievements
Rank 1
answered on 23 Dec 2011, 06:17 PM
Thank you, a sample project would be very much welcome as I mentioned :)  You guys work with this stuff day-in-day-out wheras we poor developers are in the trenches trying to make it all work in business apps!
Thanks
0
Serge
Telerik team
answered on 28 Dec 2011, 03:47 PM
Hello,

 I have prepared a simple project that you can use for a reference. When running it you will get an exception, as the interface methods are not implemented, however this means it is working. You can use this interface freely in your application, the one catch is that you will need to implement it in partial classes because if you do so in the generated ones, you might that implementation the next time the model is changed.

I hope this proves to be helpful and please do not hesitate to let us know if you face further trouble or need more information. 

Kind regards,
Serge
the Telerik team

Q3’11 of Telerik OpenAccess ORM is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
Getting Started
Asked by
David Avery
Top achievements
Rank 1
Answers by
IT-Als
Top achievements
Rank 1
PetarP
Telerik team
David Avery
Top achievements
Rank 1
Serge
Telerik team
Share this question
or