Due to the needs of a system, you need to add custom information in the log, and you need to filter to display some of the actions recorded in the changes, delete, etc., the other does not display, the specific implementation method is as follows:
First, the need to inherit auditdataitempersistent, the specific code is as follows:
Public Myauditdataitempersistent (DevExpress.Xpo.Session session) : Base (session) { } [ Xafdisplayname ("Modify caption")] public string propertycaption { get { if (auditedobject! = null) { Try { var caption = captionhelper.getmembercaption (AuditedObject.Target.GetType (), PropertyName); return caption; } Catch {} } return string. Empty;}}}
Second, the storage object of setting audit in WinApplication.cs is Myauditdataitempersistent
Three
[Xafdisplayname ("Modify Log")] Ilist<myauditdataitempersistent>xt_order_review_detail_audit {get;} [Domainlogic (typeof (XT_ORDER_REVIEW_DETAIL_DC))] public class Contactlogic {private static xpcollection<m Yauditdataitempersistent> _changehistory; public static ilist<myauditdataitempersistent> Get_xt_order_review_detail_audit (XT_ORDER_REVIEW_DETAIL_DC obj, Iobjectspace os) {var source = Auditedobjectweakreference.getaudittrail ((xpobjectspac (e) OS). Session, obj); if (Source = null) {try {_changehistory = new xpcollection& Lt Myauditdataitempersistent> (((xpobjectspace) OS). Session, source); _changehistory.filter = Criteriaoperator.parse ("operationtype= ' objectchanged '"); } catch {}} return _changehistory; Return (myauditdataitempersistent) devexpress.persisteNt. BaseImpl.AuditedObjectWeakReference.GetAuditTrail (((xpobjectspace) OS). Session, obj); }
XAF 14.1 DC implements custom audit log information