Click here to Skip to main content
13,001,454 members (61,805 online)
Click here to Skip to main content


34 bookmarked
Posted 20 May 2010

NLog Log and Audit Advanced Target

, 26 May 2010
A way to audit your business objects using NLog.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="App.Logger.WebTests._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <table width="100%">
                <td colspan="2" style="border-bottom: solid 1px black; font-size: x-small; background-color: #DCDCDC">
                    <div style="position: relative; width:100%; ">
                        <div style="float: left; padding-right: 10px; border-right : solid 1px grey;">
                                <li><b>Add Customer:</b> Adds a new Customer to the database.</li>
                                <li><b>Add Customer:</b> Adds a new Supplier to the database.</li>
                                <li><b>Create Schema:</b> Creates the necessary database objects.</li>
                                <li><b>Get History:</b> Lists all the changes made to a certain object.</li>
                                <li><b>Get Last Version:</b> Gets the record last version.</li>
                                <li><b>Get Version:</b> Gets the record version at a certain point in time.</li>
                        <div style="float: left; padding-left: 10px;">
                            <b>Thigs you may want to try:</b>
                                <li>Add or Remove properties to the Customer class with and without the [LogProperty] attribute.</li>
                                <li>Create your own object to log and mess with it!.</li>
                <td style="width: 130px; border-right: dashed 1px black; vertical-align: top;">
                    <br />
                    <asp:Button ID="btnAddCustomer" runat="server" Text="Add Customer" OnClick="btnAddCustomer_Click" Width="120px" /><br />
                    <asp:Button ID="btnAddSupplier" runat="server" Text="Add Supplier" OnClick="btnAddSupplier_Click" Width="120px" />
                    <br /><br />
                    <asp:Button ID="btnCreateSchema" runat="server" Text="Create Schema" OnClick="btnCreateSchema_Click" Width="120px" /><br />
                    <asp:Button ID="btnGetHistory" runat="server" Text="Get History" OnClick="btnGetHistory_Click" Width="120px" /><br />
                    <asp:Button ID="btnGetLastVersion" runat="server" Text="Get Last Version" OnClick="btnGetLastVersion_Click" Width="120px" /><br />
                    <asp:Button ID="btnGetVersion" runat="server" Text="Get Version" OnClick="btnGetVersion_Click" Width="120px" /><br />
                    <br />
                    <asp:Button ID="btnReadXmlConfig" runat="server" Text="Read Xml Config" OnClick="btnReadXmlConfiguration_Click" Width="120px" /><br />
                        <asp:GridView ID="gridResult" runat="server" Font-Size="Small"></asp:GridView>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Switzerland Switzerland
Senior IT Consultant working in Switzerland as Senior Software Engineer.

Find more at on my blog.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170624.1 | Last Updated 26 May 2010
Article Copyright 2010 by AlexCode
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid