示例#1
0
        /// <summary>
        /// Creates the Audit scope.
        /// </summary>
        private AuditScope CreateAuditScope(EntityFrameworkEvent efEvent)
        {
            var typeName  = GetType().Name;
            var eventType = AuditEventType?.Replace("{context}", typeName).Replace("{database}", efEvent.Database) ?? typeName;
            var scope     = AuditScope.Create(eventType, null, EventCreationPolicy.Manual, AuditDataProvider);

            if (_extraFields != null)
            {
                foreach (var field in _extraFields)
                {
                    scope.SetCustomField(field.Key, field.Value);
                }
            }
            return(scope);
        }