November Happy Hour will be moved to Thursday December 5th.

Class DefaultChangeLog

The EPiServer CMS default change log.

Inheritance
System.Object
DefaultChangeLog
Implements
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.ChangeLog
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
[ServiceConfiguration(typeof(IChangeLog))]
public class DefaultChangeLog : IChangeLog

Constructors

DefaultChangeLog()

Initializes a new instance of the DefaultChangeLog class.

Declaration
public DefaultChangeLog()

Methods

GetChangeCount()

Gets a count of all change logs

Declaration
public virtual long GetChangeCount()
Returns
Type Description
System.Int64

An System.Int64 value with the number of logs found

GetChangeCount(ChangeLogQueryInfo)

Gets a count of change logs based on the criteria passed

Declaration
public virtual long GetChangeCount(ChangeLogQueryInfo queryInfo)
Parameters
Type Name Description
ChangeLogQueryInfo queryInfo
Returns
Type Description
System.Int64

An System.Int64 value with the number of logs found

Examples
  How to use the GetChangeCount method.
        public long GetNumberOfDeletesFromUser(IChangeLog changeLog, string userName)
{
// Get the number of page deletes for specified user.
ChangeLogQueryInfo query = new ChangeLogQueryInfo();
query.ChangedBy = userName;
query.Category = (int)EPiServer.ChangeLog.ChangeLogCategory.Content;
query.Action = (int)EPiServer.ChangeLog.ChangeLogContent.ActionType.Delete;

return changeLog.GetChangeCount(query);
}

GetChangeCountBackwards(ChangeLogQueryInfo)

Gets the change count backwards.

Declaration
public virtual long GetChangeCountBackwards(ChangeLogQueryInfo queryInfo)
Parameters
Type Name Description
ChangeLogQueryInfo queryInfo

The query info.

Returns
Type Description
System.Int64

GetChangeCountForward(ChangeLogQueryInfo)

Gets the change count forward.

Declaration
public virtual long GetChangeCountForward(ChangeLogQueryInfo queryInfo)
Parameters
Type Name Description
ChangeLogQueryInfo queryInfo

The query info.

Returns
Type Description
System.Int64

GetChanges(ChangeLogQueryInfo)

Retrieves a list of IChangeLogItem items based on the criteria passed. This is the same as calling GetChanges(queryInfo, ReadDirection.Forwards, SortOrder.Ascending)

Declaration
public virtual IList<IChangeLogItem> GetChanges(ChangeLogQueryInfo queryInfo)
Parameters
Type Name Description
ChangeLogQueryInfo queryInfo

The information required to filter the query

Returns
Type Description
System.Collections.Generic.IList<IChangeLogItem>

An System.Collections.Generic.IList<T> of IChangeLogItem items.

GetChanges(ChangeLogQueryInfo, ReadDirection, SortOrder)

Retrieves a list of IChangeLogItem items based on the criteria passed

Declaration
public virtual IList<IChangeLogItem> GetChanges(ChangeLogQueryInfo queryInfo, ReadDirection direction, SortOrder order)
Parameters
Type Name Description
ChangeLogQueryInfo queryInfo

The information required to filter the query

ReadDirection direction

The direction the query should be performed in

SortOrder order

The order the data should be returned in

Returns
Type Description
System.Collections.Generic.IList<IChangeLogItem>

An System.Collections.Generic.IList<T> of IChangeLogItem items.

Examples
  How to use the GetChanges method.
        public IList<IChangeLogItem> GetPageSaveLogs(IChangeLog changeLog)
{
// Get the last 50 page save logs
ChangeLogQueryInfo query = new ChangeLogQueryInfo();
query.MaxRecordsToReturn = 50;
query.Category = (int)EPiServer.ChangeLog.ChangeLogCategory.Content;
query.Action = (int)EPiServer.ChangeLog.ChangeLogContent.ActionType.Save;

return changeLog.GetChanges(query, ReadDirection.Backwards, SortOrder.Ascending);
}

GetHighestSequenceNumber()

Gets the highest sequence number in use in the change log

Declaration
public virtual long GetHighestSequenceNumber()
Returns
Type Description
System.Int64

An System.Int64 value representing the highest sequence number used

Save(IChangeLogItem)

Saves the IChangeLogItem item

Declaration
public virtual void Save(IChangeLogItem item)
Parameters
Type Name Description
IChangeLogItem item

The item to save

Save(IEnumerable<IChangeLogItem>)

Saves the IChangeLogItem instances in the collection

Declaration
public virtual void Save(IEnumerable<IChangeLogItem> items)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IChangeLogItem> items

A collection of IChangeLogItem items

Truncate()

Truncate all entries from the change log

Declaration
public virtual void Truncate()

Truncate(DateTime)

Truncate entries from the change log

Declaration
public virtual void Truncate(DateTime olderThan)
Parameters
Type Name Description
System.DateTime olderThan

The date for which rows older than should be deleted

Truncate(Int64)

Truncate entries from the change log

Declaration
public virtual void Truncate(long rows)
Parameters
Type Name Description
System.Int64 rows

The number of rows to truncate

Truncate(Int64, DateTime)

Truncate entries from the change log

Declaration
public virtual void Truncate(long rows, DateTime olderThan)
Parameters
Type Name Description
System.Int64 rows

The number of rows to truncate

System.DateTime olderThan

The date for which rows older than should be deleted

TruncateByDependency(DateTime)

Truncate entries from the change log based on the dependecies registered with the ChangeLogSystem class. The default date of the oldest item to preserve in the change log.

Declaration
public virtual void TruncateByDependency(DateTime defaultOldestChangeDate)
Parameters
Type Name Description
System.DateTime defaultOldestChangeDate

Implements

Extension Methods