Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nescalante/historylog

an history logger for entities
https://github.com/nescalante/historylog

Last synced: 20 days ago
JSON representation

an history logger for entities

Awesome Lists containing this project

README

        

History Log
==========

Manage entities history logging on database.
All functionality are in the `LogManager` class, which exposes methods to perform logging actions.

Before starting, please deploy [database proyect](https://github.com/nescalante/historylog/tree/master/HistoryLog.Database).

## Defining entities ##

**HistoryLog** uses `System.ComponentModel.DataAnnotations` objects to map entitie keys. Entities must have at least one `[Key]` attribute in their properties.
This is an example for an entity to perform logs:

public class SomeEntity
{
[Key]
public int Id { get; set; }

public string Name { get; set; }

public int Number { get; set; }
}

## Logging entities ##

To log some entity just call the `Log` method exposed in `LogManager` class:

var lm = new LogManager("someApp", connectionString);
lm.Log(someEntity);

You can also register the user that performs action:

lm.Log(someEntity, someUserName);

## Getting history ##

To get history call the `GetHistory` method exposed in `LogManager` class.
Remember that history are obtained by `Key`, so application gets history of a particular entity:

var log = lm.GetHistory(someEntity); // returns history of the entity (by key)