public static TCreateUserRoleMvo ToCreateUserRoleMvo <TCreateUserRoleMvo>(this IUserRoleMvoState state)
            where TCreateUserRoleMvo : ICreateUserRoleMvo, new()
        {
            var cmd = new TCreateUserRoleMvo();

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

            cmd.UserRoleId               = state.UserRoleId;
            cmd.Version                  = ((IUserRoleMvoStateProperties)state).Version;
            cmd.Active                   = ((IUserRoleMvoStateProperties)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);
        }
        public static TDeleteUserRoleMvo ToDeleteUserRoleMvo <TDeleteUserRoleMvo>(this IUserRoleMvoState state)
            where TDeleteUserRoleMvo : IDeleteUserRoleMvo, new()
        {
            var cmd = new TDeleteUserRoleMvo();

            cmd.UserRoleId  = state.UserRoleId;
            cmd.UserVersion = ((IUserRoleMvoStateProperties)state).UserVersion;

            return(cmd);
        }
        public IUserRoleMvoState Get(UserRoleId id)
        {
            IUserRoleMvoState state = CurrentSession.Get <UserRoleMvoState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IUserRoleMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
        public IUserRoleMvoState Get(UserRoleId id)
        {
            IUserRoleMvoState state = CurrentSession.Get <UserRoleMvoState> (id);

            if (state == null)
            {
                state = new UserRoleMvoState();
                (state as UserRoleMvoState).UserRoleId = id;
            }
            return(state);
        }
        public void Save(IUserRoleMvoState state)
        {
            CurrentSession.SaveOrUpdate(state);

            var saveable = state as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
Example #6
0
        public IUserRoleMvoState Get(UserRoleId id, bool nullAllowed)
        {
            IUserRoleMvoState state = CurrentSession.Get <UserRoleMvoState> (id);

            if (!nullAllowed && state == null)
            {
                state = new UserRoleMvoState();
                (state as UserRoleMvoState).UserRoleId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IUserRoleMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
        public async Task <IUserRoleMvoState> GetAsync(UserRoleId userRoleId)
        {
            IUserRoleMvoState state = null;
            var idObj         = UserRoleMvoProxyUtils.ToIdString(userRoleId);
            var uriParameters = new UserRoleMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new UserRoleMvoGetRequest(uriParameters);

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

            UserRoleMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = resp.Content;
            return(state);
        }
        public void Save(IUserRoleMvoState state)
        {
            IUserRoleMvoState s = state;

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

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
 public UserRoleMvoStateDtoWrapper(IUserRoleMvoState state)
 {
     this._state = state;
 }
 public UserRoleMvoStateDtoWrapper()
 {
     this._state = new UserRoleMvoState();
 }
        protected bool IsRepeatedCommand(IUserRoleMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IUserRoleMvoState state)
        {
            bool repeated = false;

            if (((IUserRoleMvoStateProperties)state).UserVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IUserRoleMvoEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IUserRoleMvoAggregate aggregate, IUserRoleMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IUserRoleMvoStateProperties)state).UserVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IUserRoleMvoAggregate, IUserRoleMvoState>(aggregate, state, aggregate.Changes));
     }
 }
        public static TMergePatchUserRoleMvo ToMergePatchUserRoleMvo <TMergePatchUserRoleMvo>(this IUserRoleMvoState state)
            where TMergePatchUserRoleMvo : IMergePatchUserRoleMvo, new()
        {
            var cmd = new TMergePatchUserRoleMvo();

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

            cmd.UserRoleId               = state.UserRoleId;
            cmd.Version                  = ((IUserRoleMvoStateProperties)state).Version;
            cmd.Active                   = ((IUserRoleMvoStateProperties)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.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);
        }
        public static IUserRoleMvoCommand ToCreateOrMergePatchUserRoleMvo <TCreateUserRoleMvo, TMergePatchUserRoleMvo>(this IUserRoleMvoState state)
            where TCreateUserRoleMvo : ICreateUserRoleMvo, new()
            where TMergePatchUserRoleMvo : IMergePatchUserRoleMvo, new()
        {
            bool bUnsaved = ((IUserRoleMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateUserRoleMvo <TCreateUserRoleMvo>());
            }
            else
            {
                return(state.ToMergePatchUserRoleMvo <TMergePatchUserRoleMvo>());
            }
        }
Example #15
0
 public UserRoleMvoAggregate(IUserRoleMvoState state)
 {
     _state = state;
 }
Example #16
0
 public override IUserRoleMvoAggregate GetUserRoleMvoAggregate(IUserRoleMvoState state)
 {
     return(new UserRoleMvoAggregate(state));
 }
 public abstract IUserRoleMvoAggregate GetUserRoleMvoAggregate(IUserRoleMvoState state);