/// <summary> /// Utility for invoking user code for conflict interceptors /// </summary> /// <param name="context">The context to pass as parameter to user code</param> /// <param name="mergedVersion">The merged version for Merge resolution</param> /// <param name="entityType">Entity type of the conflict being raised</param> /// <returns>Actual resolution picked by user</returns> internal SyncConflictResolution?InvokeConflictInterceptor(SyncConflictContext context, Type entityType, out IOfflineEntity mergedVersion) { SyncInterceptorsInfoWrapper wrapper = null; if (this.SyncInterceptors.TryGetValue(context.ScopeName, out wrapper)) { // Look for unfiltered Conflict and if that is null then look for filtered one. // Its an error to have both unfiltered and filtered ConflictInterceptor so both cannot be set. MethodInfo methodInfo = wrapper.ConflictInterceptor ?? wrapper.GetConflictInterceptor(entityType); if (methodInfo != null) { object[] inputParams = new object[] { context, null }; SyncConflictResolution resolution = (SyncConflictResolution)InvokeUserInterceptorMethod(methodInfo, OperationContext.Current.InstanceContext.GetServiceInstance(), inputParams); // Merged version is in the second parameter which is passed by reference. Look it up mergedVersion = (IOfflineEntity)inputParams[1]; return(resolution); } } mergedVersion = null; return(null); }
/// <summary> /// Utility for invoking user code for conflict interceptors /// </summary> /// <param name="context">The context to pass as parameter to user code</param> /// <param name="mergedVersion">The merged version for Merge resolution</param> /// <param name="entityType">Entity type of the conflict being raised</param> /// <returns>Actual resolution picked by user</returns> internal SyncConflictResolution? InvokeConflictInterceptor(SyncConflictContext context, Type entityType, out IOfflineEntity mergedVersion) { SyncInterceptorsInfoWrapper wrapper = null; if (this.SyncInterceptors.TryGetValue(context.ScopeName, out wrapper)) { // Look for unfiltered Conflict and if that is null then look for filtered one. // Its an error to have both unfiltered and filtered ConflictInterceptor so both cannot be set. MethodInfo methodInfo = wrapper.ConflictInterceptor ?? wrapper.GetConflictInterceptor(entityType); if (methodInfo != null) { object[] inputParams = new object[] { context, null }; SyncConflictResolution resolution = (SyncConflictResolution)InvokeUserInterceptorMethod(methodInfo, OperationContext.Current.InstanceContext.GetServiceInstance(), inputParams); // Merged version is in the second parameter which is passed by reference. Look it up mergedVersion = (IOfflineEntity)inputParams[1]; return resolution; } } mergedVersion = null; return null; }