Ticket T263982
Visible to All Users

AuditTrail - Ensure support for scenarios with several XPObjectSpaceProviders

created 10 years ago (modified 10 years ago)

Currently, looking at the code in d:\2015.1\xaf\devexpress.expressapp.modules\devexpress.expressapp.audittrail\module.cs only the default XPDictionary is considered:

C#
private void application_SetupComplete(object sender, EventArgs e) { lock(setupLockObject) { enumDescriptor = new EnumDescriptor(typeof(AuditOperationType)); AuditTrailService.Instance.SetXPDictionary(XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary); if(AuditTrailService.Instance.AuditDataStore == null) { if(auditDataItemPersistentType != null) {

When several XPObjectSpaceProviders are registered, this default XPDictionary does not contain any types. When the AuditTrailViewController class works, it calls the following method:

C#
private void BeginAudit(ObjectView view) { if(view.CurrentObject != null) { AuditTrailService.Instance.BeginObjectsAudit(((XPObjectSpace)view.ObjectSpace).Session, view.CurrentObject); } }

which leads to the ObjectAuditProcessor class call below:

C#
public void BeginObjectAudit(object obj) { if(IsDisposed) { return;//throw new ObjectDisposedException(GetType().Name); } Guard.ArgumentNotNull(obj, "obj"); if(IsObjectToAudit(obj) && !IsObjectAudited(obj)) { //!!!!!!!!!!!! BeginObjectAuditCore(obj, GetPropertiesToAudit(obj.GetType())); } }

Here nothing is to be audited at the highlighted line, because no type is found in the default dictionary.
To avoid this problem, it is important to re-implement the default AuditTrail APIs to take into account multiple registered type info sources (very similar to what have done for the security system in Security - Exception occurs when checking permissions for an object mapped to another database in scenario with multiple EFObjectSpaceProvider registerations).

Currently, as a workaround, you can only manually control which XPDictionary to be audited as shown below:

C#
//Global.asax.cs ... protected void Session_Start(Object sender, EventArgs e) WebApplication.Instance.SetupComplete += Instance_SetupComplete; void Instance_SetupComplete(object sender, EventArgs e) { ... AuditTrailService.Instance.SetXPDictionary(((XpoTypeInfoSource)WebApplication.Instance.ObjectSpaceProviders[0].EntityStore).XPDictionary); } ...

Answers approved by DevExpress Support

created 10 years ago

We have implemented the functionality described in this ticket. It will be included in our next update(s).

Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.