private void SetAudit(object entity, EEventType eventType)
        {
            var publicKey = HttpContextAccess.GetPublicKey();

            //var id = _userRepository.FindUserByPublicKey(publicKey).Id;
            SetAuditToEntity(entity, eventType, 1);
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the <see cref="IHttpContextAccessor"/> middleware, and initializes the current <see cref="HttpContext"/>.
        /// </summary>
        /// <param name="applicationBuilder">The <see cref="IApplicationBuilder"/>.</param>
        /// <returns>The <see cref="IApplicationBuilder"/>.</returns>
        internal static IApplicationBuilder UseHttpContextAccessor(this IApplicationBuilder applicationBuilder)
        {
            if (applicationBuilder == null)
            {
                throw new ArgumentNullException(nameof(applicationBuilder));
            }

            var httpContextAccessor = applicationBuilder.ApplicationServices
                                      .GetRequiredService <IHttpContextAccessor>();

            HttpContextAccess.Configure(httpContextAccessor);

            return(applicationBuilder);
        }