Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/nescalante/historylog
- Owner: nescalante
- Created: 2012-11-30T17:34:31.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-12-31T01:32:26.000Z (almost 12 years ago)
- Last Synced: 2024-04-14T22:16:03.319Z (8 months ago)
- Language: C#
- Size: 152 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HistoryLog.Database/HistoryLog.Database.sqlproj
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)