コード例 #1
0
        public static TCreateUserClaimMvo ToCreateUserClaimMvo <TCreateUserClaimMvo>(this IUserClaimMvoState state)
            where TCreateUserClaimMvo : ICreateUserClaimMvo, new()
        {
            var cmd = new TCreateUserClaimMvo();

            cmd.UserVersion = ((IUserClaimMvoStateProperties)state).UserVersion;

            cmd.UserClaimId              = state.UserClaimId;
            cmd.ClaimType                = state.ClaimType;
            cmd.ClaimValue               = state.ClaimValue;
            cmd.Version                  = ((IUserClaimMvoStateProperties)state).Version;
            cmd.Active                   = ((IUserClaimMvoStateProperties)state).Active;
            cmd.UserUserName             = state.UserUserName;
            cmd.UserAccessFailedCount    = state.UserAccessFailedCount;
            cmd.UserEmail                = state.UserEmail;
            cmd.UserEmailConfirmed       = state.UserEmailConfirmed;
            cmd.UserLockoutEnabled       = state.UserLockoutEnabled;
            cmd.UserLockoutEndDateUtc    = state.UserLockoutEndDateUtc;
            cmd.UserPasswordHash         = state.UserPasswordHash;
            cmd.UserPhoneNumber          = state.UserPhoneNumber;
            cmd.UserPhoneNumberConfirmed = state.UserPhoneNumberConfirmed;
            cmd.UserTwoFactorEnabled     = state.UserTwoFactorEnabled;
            cmd.UserSecurityStamp        = state.UserSecurityStamp;
            cmd.UserCreatedBy            = state.UserCreatedBy;
            cmd.UserCreatedAt            = state.UserCreatedAt;
            cmd.UserUpdatedBy            = state.UserUpdatedBy;
            cmd.UserUpdatedAt            = state.UserUpdatedAt;
            cmd.UserActive               = state.UserActive;
            cmd.UserDeleted              = state.UserDeleted;
            return(cmd);
        }
コード例 #2
0
        public static TDeleteUserClaimMvo ToDeleteUserClaimMvo <TDeleteUserClaimMvo>(this IUserClaimMvoState state)
            where TDeleteUserClaimMvo : IDeleteUserClaimMvo, new()
        {
            var cmd = new TDeleteUserClaimMvo();

            cmd.UserClaimId = state.UserClaimId;
            cmd.UserVersion = ((IUserClaimMvoStateProperties)state).UserVersion;

            return(cmd);
        }
コード例 #3
0
        public IUserClaimMvoState Get(UserClaimId id)
        {
            IUserClaimMvoState state = CurrentSession.Get <UserClaimMvoState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IUserClaimMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
コード例 #4
0
        public void Save(IUserClaimMvoState state)
        {
            CurrentSession.SaveOrUpdate(state);

            var saveable = state as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
コード例 #5
0
        public IUserClaimMvoState Get(UserClaimId id)
        {
            IUserClaimMvoState state = CurrentSession.Get <UserClaimMvoState> (id);

            if (state == null)
            {
                state = new UserClaimMvoState();
                (state as UserClaimMvoState).UserClaimId = id;
            }
            return(state);
        }
コード例 #6
0
        public IUserClaimMvoState Get(UserClaimId id, bool nullAllowed)
        {
            IUserClaimMvoState state = CurrentSession.Get <UserClaimMvoState> (id);

            if (!nullAllowed && state == null)
            {
                state = new UserClaimMvoState();
                (state as UserClaimMvoState).UserClaimId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IUserClaimMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
コード例 #7
0
        public async Task <IUserClaimMvoState> GetAsync(UserClaimId userClaimId)
        {
            IUserClaimMvoState state = null;
            var idObj         = UserClaimMvoProxyUtils.ToIdString(userClaimId);
            var uriParameters = new UserClaimMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new UserClaimMvoGetRequest(uriParameters);

            var resp = await _ramlClient.UserClaimMvo.Get(req);

            UserClaimMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = resp.Content;
            return(state);
        }
コード例 #8
0
        public void Save(IUserClaimMvoState state)
        {
            IUserClaimMvoState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IUserClaimMvoState>(state);
            }
            CurrentSession.SaveOrUpdate(s);

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
コード例 #9
0
        public static IUserClaimMvoCommand ToCreateOrMergePatchUserClaimMvo <TCreateUserClaimMvo, TMergePatchUserClaimMvo>(this IUserClaimMvoState state)
            where TCreateUserClaimMvo : ICreateUserClaimMvo, new()
            where TMergePatchUserClaimMvo : IMergePatchUserClaimMvo, new()
        {
            bool bUnsaved = ((IUserClaimMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateUserClaimMvo <TCreateUserClaimMvo>());
            }
            else
            {
                return(state.ToMergePatchUserClaimMvo <TMergePatchUserClaimMvo>());
            }
        }
コード例 #10
0
 public UserClaimMvoAggregate(IUserClaimMvoState state)
 {
     _state = state;
 }
コード例 #11
0
 public override IUserClaimMvoAggregate GetUserClaimMvoAggregate(IUserClaimMvoState state)
 {
     return(new UserClaimMvoAggregate(state));
 }
コード例 #12
0
        protected bool IsRepeatedCommand(IUserClaimMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IUserClaimMvoState state)
        {
            bool repeated = false;

            if (((IUserClaimMvoStateProperties)state).UserVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IUserClaimMvoEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
コード例 #13
0
 public abstract IUserClaimMvoAggregate GetUserClaimMvoAggregate(IUserClaimMvoState state);
コード例 #14
0
 public UserClaimMvoStateDtoWrapper(IUserClaimMvoState state)
 {
     this._state = state;
 }
コード例 #15
0
 public UserClaimMvoStateDtoWrapper()
 {
     this._state = new UserClaimMvoState();
 }
コード例 #16
0
        public static TMergePatchUserClaimMvo ToMergePatchUserClaimMvo <TMergePatchUserClaimMvo>(this IUserClaimMvoState state)
            where TMergePatchUserClaimMvo : IMergePatchUserClaimMvo, new()
        {
            var cmd = new TMergePatchUserClaimMvo();

            cmd.UserVersion = ((IUserClaimMvoStateProperties)state).UserVersion;

            cmd.UserClaimId              = state.UserClaimId;
            cmd.ClaimType                = state.ClaimType;
            cmd.ClaimValue               = state.ClaimValue;
            cmd.Version                  = ((IUserClaimMvoStateProperties)state).Version;
            cmd.Active                   = ((IUserClaimMvoStateProperties)state).Active;
            cmd.UserUserName             = state.UserUserName;
            cmd.UserAccessFailedCount    = state.UserAccessFailedCount;
            cmd.UserEmail                = state.UserEmail;
            cmd.UserEmailConfirmed       = state.UserEmailConfirmed;
            cmd.UserLockoutEnabled       = state.UserLockoutEnabled;
            cmd.UserLockoutEndDateUtc    = state.UserLockoutEndDateUtc;
            cmd.UserPasswordHash         = state.UserPasswordHash;
            cmd.UserPhoneNumber          = state.UserPhoneNumber;
            cmd.UserPhoneNumberConfirmed = state.UserPhoneNumberConfirmed;
            cmd.UserTwoFactorEnabled     = state.UserTwoFactorEnabled;
            cmd.UserSecurityStamp        = state.UserSecurityStamp;
            cmd.UserCreatedBy            = state.UserCreatedBy;
            cmd.UserCreatedAt            = state.UserCreatedAt;
            cmd.UserUpdatedBy            = state.UserUpdatedBy;
            cmd.UserUpdatedAt            = state.UserUpdatedAt;
            cmd.UserActive               = state.UserActive;
            cmd.UserDeleted              = state.UserDeleted;

            if (state.ClaimType == null)
            {
                cmd.IsPropertyClaimTypeRemoved = true;
            }
            if (state.ClaimValue == null)
            {
                cmd.IsPropertyClaimValueRemoved = true;
            }
            if (state.UserUserName == null)
            {
                cmd.IsPropertyUserUserNameRemoved = true;
            }
            if (state.UserEmail == null)
            {
                cmd.IsPropertyUserEmailRemoved = true;
            }
            if (state.UserLockoutEndDateUtc == null)
            {
                cmd.IsPropertyUserLockoutEndDateUtcRemoved = true;
            }
            if (state.UserPasswordHash == null)
            {
                cmd.IsPropertyUserPasswordHashRemoved = true;
            }
            if (state.UserPhoneNumber == null)
            {
                cmd.IsPropertyUserPhoneNumberRemoved = true;
            }
            if (state.UserSecurityStamp == null)
            {
                cmd.IsPropertyUserSecurityStampRemoved = true;
            }
            if (state.UserCreatedBy == null)
            {
                cmd.IsPropertyUserCreatedByRemoved = true;
            }
            if (state.UserUpdatedBy == null)
            {
                cmd.IsPropertyUserUpdatedByRemoved = true;
            }
            return(cmd);
        }
コード例 #17
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IUserClaimMvoAggregate aggregate, IUserClaimMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IUserClaimMvoStateProperties)state).UserVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IUserClaimMvoAggregate, IUserClaimMvoState>(aggregate, state, aggregate.Changes));
     }
 }