예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuditLogger"/> class.
        /// </summary>
        /// <param name="objectContext">The <see cref="ObjectContext"/> to create the <see cref="AuditLog"/> from.</param>
        /// <param name="configuration">The <see cref="AuditConfiguration"/> to use when creating the <see cref="AuditLog"/>.</param>
        public AuditLogger(ObjectContext objectContext, AuditConfiguration configuration)
        {
            if (objectContext == null)
            {
                throw new ArgumentNullException("objectContext");
            }

            _objectContext = objectContext;
            _configuration = configuration ?? AuditConfiguration.Default;

            AttachEvents();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AuditLogger"/> class.
        /// </summary>
        /// <param name="dbContext">The <see cref="DbContext"/> to create the <see cref="AuditLog"/> from.</param>
        /// <param name="configuration">The <see cref="AuditConfiguration"/> to use when creating the <see cref="AuditLog"/>.</param>
        public AuditLogger(DbContext dbContext, AuditConfiguration configuration)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("dbContext");
            }

            var adapter = (IObjectContextAdapter)dbContext;

            _objectContext = adapter.ObjectContext;
            _configuration = configuration ?? AuditConfiguration.Default;

            AttachEvents();
        }
 internal AuditEntityConfiguration(AuditConfiguration auditConfiguration)
 {
     _auditConfiguration = auditConfiguration;
 }