Skip to main content

Posts

Showing posts with the label Context

Activity logs through Telerik Data Access

Some time back I had written a blog on managing history for required models ( http://vikutech.blogspot.in/2015/08/implementing-automating-audit-logs-in-telerik-data- access.html ). In this particular example, we would be looking for managing small summary of information based on tables affected in the particular request of context. Like what kind of operation were done on models and by whom. The approach for implementation is to create required model to store summary information and attach DB context events based on required format. The Basic data model for collecting information, just having user identifier and message. /// <summary> /// User activity log domain model /// </summary> public class UserActivityLog : IPrimaryKey<int> { /// <summary> /// Gets or sets the identifier. /// </summary> /// <value>The identifier.</value> public int Id { get; set; } /// <summa...

Implementing/Automating audit logs in Telerik Data Access

Audit logs can be tedious task if done manually, also developer might miss to update audit log implementation on certain level. The codes would be repeated on all places if not centralized. There are many approach available to maintain change history of model/table. Like having single history table and manage all changes of all models in same table. We may maintain in same table with some flags and JSON data for change list. We will look for maintaining history table based on each required data models with minimum effort and performance. To reduce code, I am going to use T4 to generate history models automatically based on original model. Also we are going to take care of Artificial type values. Step 1 - Create a custom attribute to mark model that history need to be maintained. /// <summary> /// Attribute to maintain history table /// </summary> [AttributeUsage(AttributeTargets.Class)] public class ManageHistoryAttribute : Attribute ...