/// <summary>
        ///      获取当前用户.
        /// </summary>
        /// <returns>
        ///     The <see cref="CurrentUserDTO" />.
        /// </returns>
        public CurrentMemberUserDto GetCurrentMemberUser()
        {
            CurrentMemberUserDto currentUser = new CurrentMemberUserDto();
            Guid   currentUserId             = Guid.Empty;
            string userId = ((string)PerRequestManager.GetValue("CurrentUserID"));
            string key    = userId + CacheKeyConstantVariable.CurrentUser;

            userId = userId ?? string.Empty;
            //if (Guid.TryParse(userId, out currentUserId))
            //{
            //    currentUser = this.CacheManager.Get(
            //        key,
            //        () =>
            //        {
            //            var memberBussiness = EngineContext.Current.DependencyContainer.Resolve<IMemberBussinessService>();
            //            var response = memberBussiness.GetMemberById(currentUserId);
            //            if (response.IsSuccess)
            //            {
            //                var user = response.Result;
            //                if (user != null)
            //                {
            //                    currentUser.Inject(user);
            //                    return currentUser;
            //                }
            //            }
            //            return null;
            //        },
            //        TimeSpan.FromDays(1));
            //}
            return(currentUser);
        }
 /// <summary>
 ///  注册一个更改的对象到仓储上下文中
 /// </summary>
 /// <typeparam name="TEntity"> 要注册的类型 </typeparam>
 /// <typeparam name="TKey">实体主键类型</typeparam>
 /// <param name="entity"> 要注册的对象 </param>
 public void RegisterUpdate <TEntity, TKey>(TEntity entity) where TEntity : BaseEntity <TKey>
 {
     entity.UpdatedTime = DateTime.Now;
     if (null == entity.UpdatedUser || Guid.Empty == entity.UpdatedUser || !entity.UpdatedUser.HasValue)
     {
         Guid currentUserId = Guid.Empty;
         Guid.TryParse(PerRequestManager.GetValue("CurrentUserID") == null ? Guid.Empty.ToString() : PerRequestManager.GetValue("CurrentUserID").ToString(), out currentUserId);
         entity.UpdatedUser = currentUserId;
     }
     Context.Entry(entity).State = EntityState.Modified;
     IsCommitted = false;
 }
        /// <summary>
        /// 注册一个新的对象到仓储上下文中
        /// </summary>
        /// <typeparam name="TEntity"> 要注册的类型 </typeparam>
        /// <typeparam name="TKey">实体主键类型</typeparam>
        /// <param name="entity"> 要注册的对象 </param>
        public void RegisterCreate <TEntity, TKey>(TEntity entity) where TEntity : BaseEntity <TKey>
        {
            entity.CreatedTime = DateTime.Now;
            Guid currentUserId = Guid.Empty;

            Guid.TryParse(PerRequestManager.GetValue("CurrentUserID") == null ? Guid.Empty.ToString() : PerRequestManager.GetValue("CurrentUserID").ToString(), out currentUserId);
            if (null == entity.CreatedUser || Guid.Empty == entity.CreatedUser || !entity.CreatedUser.HasValue)
            {
                entity.CreatedUser = currentUserId;
                //entity.CreatedUserPath = PerRequestManager.GetValue("CurrentUserPath") == null ? "" : PerRequestManager.GetValue("CurrentUserPath").ToString();
            }
            EntityState state = Context.Entry(entity).State;

            if (state == EntityState.Detached)
            {
                Context.Entry(entity).State = EntityState.Added;
            }
            IsCommitted = false;
        }
 /// <summary>
 /// 设置值
 /// </summary>
 /// <param name="newValue"></param>
 public override void SetValue(object newValue)
 {
     PerRequestManager.SetValue(_key.ToString(), newValue);
 }
 /// <summary>
 /// 移除值
 /// </summary>
 public override void RemoveValue()
 {
     PerRequestManager.RemoveValue(_key.ToString());
 }
 /// <summary>
 /// 取值
 /// </summary>
 /// <returns></returns>
 public override object GetValue()
 {
     return(PerRequestManager.GetValue(_key.ToString()));
 }