constructed. Changes DatabaseContext to not be a singleton. Changes ServiceContext not to be a singleton. Removed ServicesFactory. Updated unit tests to support new changes.
29 lines
1.3 KiB
C#
29 lines
1.3 KiB
C#
using System;
|
|
using Umbraco.Core.Models.Rdbms;
|
|
using Umbraco.Core.Persistence;
|
|
|
|
namespace Umbraco.Core.Auditing
|
|
{
|
|
internal class DataAuditWriteProvider : IAuditWriteProvider
|
|
{
|
|
/// <summary>
|
|
/// Writes an audit entry to the underlaying datastore.
|
|
/// </summary>
|
|
/// <param name="objectId">Id of the object (Content, ContentType, Media, etc.)</param>
|
|
/// <param name="userId">Id of the user</param>
|
|
/// <param name="date">Datestamp</param>
|
|
/// <param name="header">Audit header</param>
|
|
/// <param name="comment">Audit comment</param>
|
|
public void WriteEntry(int objectId, int userId, DateTime date, string header, string comment)
|
|
{
|
|
ApplicationContext.Current.DatabaseContext.Database.Insert(new LogDto
|
|
{
|
|
Comment = comment,
|
|
Datestamp = date,
|
|
Header = header,
|
|
NodeId = objectId,
|
|
UserId = userId
|
|
});
|
|
}
|
|
}
|
|
} |