Beispiel #1
0
 protected BaseUnitOfWork(UnitOfWorkContext context) : this()
 {
     _id           = context.Id;
     SessionId     = context.SessionId;
     UserSignature = context.UserSignature;
     TimeOut       = context.TimeOut;
 }
        protected virtual T Create_Internal(UnitOfWorkContext context)
        {
            if (context == null)
            {
                return(Activator.CreateInstance <T>());
            }

            return((T)Activator.CreateInstance(typeof(T), context));
        }
        public IUnitOfWork Create(bool isShortSession, int?timeOut)
        {
            var defaultContext = new UnitOfWorkContext
            {
                TimeOut       = timeOut,
                UserSignature = WMSEnvironment.Instance.AuthenticatedUser == null
                    ? null
                    : WMSEnvironment.Instance.AuthenticatedUser.GetSignature(),
                SessionId = !WMSEnvironment.Instance.SessionId.HasValue
                    ? null
                    : (int?)WMSEnvironment.Instance.SessionId.Value
            };

            if (!isShortSession)
            {
                defaultContext.Id = Guid.NewGuid();
            }
            return(Create(defaultContext));
        }
 public IUnitOfWork Create(UnitOfWorkContext context)
 {
     return(Create_Internal(context));
 }