public IGoodIdentificationTypeState Get(string id) { IGoodIdentificationTypeState state = CurrentSession.Get <GoodIdentificationTypeState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IGoodIdentificationTypeState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public IGoodIdentificationTypeState Get(string id, bool nullAllowed) { IGoodIdentificationTypeState state = CurrentSession.Get <GoodIdentificationTypeState> (id); if (!nullAllowed && state == null) { state = new GoodIdentificationTypeState(); (state as GoodIdentificationTypeState).GoodIdentificationTypeId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IGoodIdentificationTypeState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public async Task <IGoodIdentificationTypeState> GetAsync(string goodIdentificationTypeId) { IGoodIdentificationTypeState state = null; var idObj = goodIdentificationTypeId; var uriParameters = new GoodIdentificationTypeUriParameters(); uriParameters.Id = idObj; var req = new GoodIdentificationTypeGetRequest(uriParameters); var resp = await _ramlClient.GoodIdentificationType.Get(req); GoodIdentificationTypeProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToGoodIdentificationTypeState(); return(state); }
public void Save(IGoodIdentificationTypeState state) { IGoodIdentificationTypeState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IGoodIdentificationTypeState>(state); } CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Flush(); }
public override IGoodIdentificationTypeAggregate GetGoodIdentificationTypeAggregate(IGoodIdentificationTypeState state) { return(new GoodIdentificationTypeAggregate(state)); }
protected bool IsRepeatedCommand(IGoodIdentificationTypeCommand command, IEventStoreAggregateId eventStoreAggregateId, IGoodIdentificationTypeState state) { bool repeated = false; if (((IGoodIdentificationTypeStateProperties)state).Version > command.AggregateVersion) { var lastEvent = EventStore.GetEvent(typeof(IGoodIdentificationTypeEvent), eventStoreAggregateId, command.AggregateVersion); if (lastEvent != null && lastEvent.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IGoodIdentificationTypeAggregate aggregate, IGoodIdentificationTypeState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IGoodIdentificationTypeStateProperties)state).Version, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IGoodIdentificationTypeAggregate, IGoodIdentificationTypeState>(aggregate, state, aggregate.Changes)); } }
public abstract IGoodIdentificationTypeAggregate GetGoodIdentificationTypeAggregate(IGoodIdentificationTypeState state);
public GoodIdentificationTypeStateDtoWrapper(IGoodIdentificationTypeState state) { this._state = state; }
public GoodIdentificationTypeStateDtoWrapper() { this._state = new GoodIdentificationTypeState(); }
public GoodIdentificationTypeAggregate(IGoodIdentificationTypeState state) { _state = state; }
public static TCreateGoodIdentificationType ToCreateGoodIdentificationType <TCreateGoodIdentificationType>(this IGoodIdentificationTypeState state) where TCreateGoodIdentificationType : ICreateGoodIdentificationType, new() { var cmd = new TCreateGoodIdentificationType(); cmd.Version = ((IGoodIdentificationTypeStateProperties)state).Version; cmd.GoodIdentificationTypeId = state.GoodIdentificationTypeId; cmd.ParentTypeId = state.ParentTypeId; cmd.HasTable = state.HasTable; cmd.Description = state.Description; cmd.Active = ((IGoodIdentificationTypeStateProperties)state).Active; return(cmd); }
public static TMergePatchGoodIdentificationType ToMergePatchGoodIdentificationType <TMergePatchGoodIdentificationType>(this IGoodIdentificationTypeState state) where TMergePatchGoodIdentificationType : IMergePatchGoodIdentificationType, new() { var cmd = new TMergePatchGoodIdentificationType(); cmd.Version = ((IGoodIdentificationTypeStateProperties)state).Version; cmd.GoodIdentificationTypeId = state.GoodIdentificationTypeId; cmd.ParentTypeId = state.ParentTypeId; cmd.HasTable = state.HasTable; cmd.Description = state.Description; cmd.Active = ((IGoodIdentificationTypeStateProperties)state).Active; if (state.ParentTypeId == null) { cmd.IsPropertyParentTypeIdRemoved = true; } if (state.HasTable == null) { cmd.IsPropertyHasTableRemoved = true; } if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } return(cmd); }
public static TDeleteGoodIdentificationType ToDeleteGoodIdentificationType <TDeleteGoodIdentificationType>(this IGoodIdentificationTypeState state) where TDeleteGoodIdentificationType : IDeleteGoodIdentificationType, new() { var cmd = new TDeleteGoodIdentificationType(); cmd.GoodIdentificationTypeId = state.GoodIdentificationTypeId; cmd.Version = ((IGoodIdentificationTypeStateProperties)state).Version; return(cmd); }
public static IGoodIdentificationTypeCommand ToCreateOrMergePatchGoodIdentificationType <TCreateGoodIdentificationType, TMergePatchGoodIdentificationType>(this IGoodIdentificationTypeState state) where TCreateGoodIdentificationType : ICreateGoodIdentificationType, new() where TMergePatchGoodIdentificationType : IMergePatchGoodIdentificationType, new() { bool bUnsaved = ((IGoodIdentificationTypeState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateGoodIdentificationType <TCreateGoodIdentificationType>()); } else { return(state.ToMergePatchGoodIdentificationType <TMergePatchGoodIdentificationType>()); } }