public IAttributeUseMvoState Get(AttributeSetAttributeUseId id) { IAttributeUseMvoState state = CurrentSession.Get <AttributeUseMvoState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IAttributeUseMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public IAttributeUseMvoState Get(AttributeSetAttributeUseId id) { IAttributeUseMvoState state = CurrentSession.Get <AttributeUseMvoState> (id); if (state == null) { state = new AttributeUseMvoState(); (state as AttributeUseMvoState).AttributeSetAttributeUseId = id; } return(state); }
public void Save(IAttributeUseMvoState state) { CurrentSession.SaveOrUpdate(state); var saveable = state as ISaveable; if (saveable != null) { saveable.Save(); } }
public IAttributeUseMvoState Get(AttributeSetAttributeUseId id, bool nullAllowed) { IAttributeUseMvoState state = CurrentSession.Get <AttributeUseMvoState> (id); if (!nullAllowed && state == null) { state = new AttributeUseMvoState(); (state as AttributeUseMvoState).AttributeSetAttributeUseId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IAttributeUseMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public async Task <IAttributeUseMvoState> GetAsync(AttributeSetAttributeUseId attributeSetAttributeUseId) { IAttributeUseMvoState state = null; var idObj = AttributeUseMvoProxyUtils.ToIdString(attributeSetAttributeUseId); var uriParameters = new AttributeUseMvoUriParameters(); uriParameters.Id = idObj; var req = new AttributeUseMvoGetRequest(uriParameters); var resp = await _ramlClient.AttributeUseMvo.Get(req); AttributeUseMvoProxyUtils.ThrowOnHttpResponseError(resp); state = resp.Content; return(state); }
public void Save(IAttributeUseMvoState state) { IAttributeUseMvoState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IAttributeUseMvoState>(state); } CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } }
public override IAttributeUseMvoAggregate GetAttributeUseMvoAggregate(IAttributeUseMvoState state) { return(new AttributeUseMvoAggregate(state)); }
public static IAttributeUseMvoCommand ToCreateOrMergePatchAttributeUseMvo <TCreateAttributeUseMvo, TMergePatchAttributeUseMvo>(this IAttributeUseMvoState state) where TCreateAttributeUseMvo : ICreateAttributeUseMvo, new() where TMergePatchAttributeUseMvo : IMergePatchAttributeUseMvo, new() { bool bUnsaved = ((IAttributeUseMvoState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateAttributeUseMvo <TCreateAttributeUseMvo>()); } else { return(state.ToMergePatchAttributeUseMvo <TMergePatchAttributeUseMvo>()); } }
public AttributeUseMvoAggregate(IAttributeUseMvoState state) { _state = state; }
public static TMergePatchAttributeUseMvo ToMergePatchAttributeUseMvo <TMergePatchAttributeUseMvo>(this IAttributeUseMvoState state) where TMergePatchAttributeUseMvo : IMergePatchAttributeUseMvo, new() { var cmd = new TMergePatchAttributeUseMvo(); cmd.AttributeSetVersion = ((IAttributeUseMvoStateProperties)state).AttributeSetVersion; cmd.AttributeSetAttributeUseId = state.AttributeSetAttributeUseId; cmd.SequenceNumber = state.SequenceNumber; cmd.Version = ((IAttributeUseMvoStateProperties)state).Version; cmd.Active = ((IAttributeUseMvoStateProperties)state).Active; cmd.AttributeSetAttributeSetName = state.AttributeSetAttributeSetName; cmd.AttributeSetOrganizationId = state.AttributeSetOrganizationId; cmd.AttributeSetDescription = state.AttributeSetDescription; cmd.AttributeSetReferenceId = state.AttributeSetReferenceId; cmd.AttributeSetIsInstanceAttributeSet = state.AttributeSetIsInstanceAttributeSet; cmd.AttributeSetIsMandatory = state.AttributeSetIsMandatory; cmd.AttributeSetCreatedBy = state.AttributeSetCreatedBy; cmd.AttributeSetCreatedAt = state.AttributeSetCreatedAt; cmd.AttributeSetUpdatedBy = state.AttributeSetUpdatedBy; cmd.AttributeSetUpdatedAt = state.AttributeSetUpdatedAt; cmd.AttributeSetActive = state.AttributeSetActive; cmd.AttributeSetDeleted = state.AttributeSetDeleted; if (state.AttributeSetAttributeSetName == null) { cmd.IsPropertyAttributeSetAttributeSetNameRemoved = true; } if (state.AttributeSetOrganizationId == null) { cmd.IsPropertyAttributeSetOrganizationIdRemoved = true; } if (state.AttributeSetDescription == null) { cmd.IsPropertyAttributeSetDescriptionRemoved = true; } if (state.AttributeSetReferenceId == null) { cmd.IsPropertyAttributeSetReferenceIdRemoved = true; } if (state.AttributeSetCreatedBy == null) { cmd.IsPropertyAttributeSetCreatedByRemoved = true; } if (state.AttributeSetUpdatedBy == null) { cmd.IsPropertyAttributeSetUpdatedByRemoved = true; } return(cmd); }
protected bool IsRepeatedCommand(IAttributeUseMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IAttributeUseMvoState state) { bool repeated = false; if (((IAttributeUseMvoStateProperties)state).AttributeSetVersion > command.AggregateVersion) { var lastEvent = EventStore.GetEvent(typeof(IAttributeUseMvoEvent), eventStoreAggregateId, command.AggregateVersion); if (lastEvent != null && lastEvent.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
public static TCreateAttributeUseMvo ToCreateAttributeUseMvo <TCreateAttributeUseMvo>(this IAttributeUseMvoState state) where TCreateAttributeUseMvo : ICreateAttributeUseMvo, new() { var cmd = new TCreateAttributeUseMvo(); cmd.AttributeSetVersion = ((IAttributeUseMvoStateProperties)state).AttributeSetVersion; cmd.AttributeSetAttributeUseId = state.AttributeSetAttributeUseId; cmd.SequenceNumber = state.SequenceNumber; cmd.Version = ((IAttributeUseMvoStateProperties)state).Version; cmd.Active = ((IAttributeUseMvoStateProperties)state).Active; cmd.AttributeSetAttributeSetName = state.AttributeSetAttributeSetName; cmd.AttributeSetOrganizationId = state.AttributeSetOrganizationId; cmd.AttributeSetDescription = state.AttributeSetDescription; cmd.AttributeSetReferenceId = state.AttributeSetReferenceId; cmd.AttributeSetIsInstanceAttributeSet = state.AttributeSetIsInstanceAttributeSet; cmd.AttributeSetIsMandatory = state.AttributeSetIsMandatory; cmd.AttributeSetCreatedBy = state.AttributeSetCreatedBy; cmd.AttributeSetCreatedAt = state.AttributeSetCreatedAt; cmd.AttributeSetUpdatedBy = state.AttributeSetUpdatedBy; cmd.AttributeSetUpdatedAt = state.AttributeSetUpdatedAt; cmd.AttributeSetActive = state.AttributeSetActive; cmd.AttributeSetDeleted = state.AttributeSetDeleted; return(cmd); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IAttributeUseMvoAggregate aggregate, IAttributeUseMvoState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IAttributeUseMvoStateProperties)state).AttributeSetVersion, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IAttributeUseMvoAggregate, IAttributeUseMvoState>(aggregate, state, aggregate.Changes)); } }
public abstract IAttributeUseMvoAggregate GetAttributeUseMvoAggregate(IAttributeUseMvoState state);
public static TDeleteAttributeUseMvo ToDeleteAttributeUseMvo <TDeleteAttributeUseMvo>(this IAttributeUseMvoState state) where TDeleteAttributeUseMvo : IDeleteAttributeUseMvo, new() { var cmd = new TDeleteAttributeUseMvo(); cmd.AttributeSetAttributeUseId = state.AttributeSetAttributeUseId; cmd.AttributeSetVersion = ((IAttributeUseMvoStateProperties)state).AttributeSetVersion; return(cmd); }
public AttributeUseMvoStateDtoWrapper(IAttributeUseMvoState state) { this._state = state; }
public AttributeUseMvoStateDtoWrapper() { this._state = new AttributeUseMvoState(); }