simple CUD audit trail?

7 posts, 0 answers
  1. David Avery
    David Avery avatar
    57 posts
    Member since:
    Apr 2006

    Posted 14 Dec 2011 Link to this post

    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
  2. TSE
    TSE avatar
    381 posts
    Member since:
    Sep 2008

    Posted 15 Dec 2011 Link to this post

    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
  3. DevCraft banner
  4. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 19 Dec 2011 Link to this post

    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!

  5. David Avery
    David Avery avatar
    57 posts
    Member since:
    Apr 2006

    Posted 22 Dec 2011 Link to this post

    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?
  6. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 23 Dec 2011 Link to this post

    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!

  7. David Avery
    David Avery avatar
    57 posts
    Member since:
    Apr 2006

    Posted 23 Dec 2011 Link to this post

    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
  8. Serge
    Admin
    Serge avatar
    375 posts

    Posted 28 Dec 2011 Link to this post

    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!

Back to Top
DevCraft banner