Exemplo n.º 1
0
        private static void ConfigureAuditing(IPersistenceContext context, ServiceOperationAttribute attribute, IInvocation invocation)
        {
            // if this is a read-context, there is no change set to audit
            var uctx = context as IUpdateContext;

            if (uctx == null)
            {
                return;
            }

            // if this operation is marked as not auditable, then explicitly
            // disable the change set recorder
            if (attribute.ChangeSetAuditable == false)
            {
                uctx.ChangeSetRecorder = null;
                return;
            }

            // if the current context has a change-set recorder installed
            // ensure that the ChangeSetRecorder.OperationName property is set appropriately
            // if the name is already set (by an outer service layer), don't change it
            if (uctx.ChangeSetRecorder != null && string.IsNullOrEmpty(uctx.ChangeSetRecorder.OperationName))
            {
                uctx.ChangeSetRecorder.OperationName = string.Format("{0}.{1}",
                                                                     invocation.InvocationTarget.GetType().FullName, invocation.Method.Name);
            }
        }
		private static void ConfigureAuditing(IPersistenceContext context, ServiceOperationAttribute attribute, IInvocation invocation)
		{
			// if this is a read-context, there is no change set to audit
			var uctx = context as IUpdateContext;
			if (uctx == null)
				return;

			// if this operation is marked as not auditable, then explicitly
			// disable the change set recorder
			if (attribute.ChangeSetAuditable == false)
			{
				uctx.ChangeSetRecorder = null;
				return;
			}

			// if the current context has a change-set recorder installed
			// ensure that the ChangeSetRecorder.OperationName property is set appropriately
			// if the name is already set (by an outer service layer), don't change it
			if (uctx.ChangeSetRecorder != null && string.IsNullOrEmpty(uctx.ChangeSetRecorder.OperationName))
			{
				uctx.ChangeSetRecorder.OperationName = string.Format("{0}.{1}",
					invocation.InvocationTarget.GetType().FullName, invocation.Method.Name);
			}
		}