public static string ToIdString(InOutLineId id) { var formatter = (new ValueObjectTextFormatter <InOutLineId>()); var idStr = formatter.ToString(id); return(idStr); }
public override EventStream LoadEventStream(Type eventType, IEventStoreAggregateId eventStoreAggregateId, long version) { Type supportedEventType = typeof(InOutLineMvoEventBase); if (!eventType.IsAssignableFrom(supportedEventType)) { throw new NotSupportedException(); } InOutLineId idObj = (InOutLineId)(eventStoreAggregateId as EventStoreAggregateId).Id; var criteria = CurrentSession.CreateCriteria <InOutLineMvoEventBase>(); criteria.Add(Restrictions.Eq("InOutLineMvoEventId.InOutLineIdInOutDocumentNumber", idObj.InOutDocumentNumber)); criteria.Add(Restrictions.Eq("InOutLineMvoEventId.InOutLineIdLineNumber", idObj.LineNumber)); criteria.Add(Restrictions.Le("InOutLineMvoEventId.InOutVersion", version)); criteria.AddOrder(global::NHibernate.Criterion.Order.Asc("InOutLineMvoEventId.InOutVersion")); var es = criteria.List <IEvent>(); foreach (InOutLineMvoEventBase e in es) { e.EventReadOnly = true; } return(new EventStream() { SteamVersion = es.Count > 0 ? ((InOutLineMvoEventBase)es.Last()).InOutLineMvoEventId.InOutVersion : default(long), Events = es }); }
public static string ToIdString(InOutLineId id) { var formatter = new InOutLineIdFlattenedDtoFormatter(); var idDto = new InOutLineIdFlattenedDto(id); var idStr = formatter.ToString(idDto); return(idStr); }
public IInOutLineMvoState Get(InOutLineId id) { IInOutLineMvoState state = CurrentSession.Get <InOutLineMvoState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IInOutLineMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public IInOutLineMvoState Get(InOutLineId id) { IInOutLineMvoState state = CurrentSession.Get <InOutLineMvoState> (id); if (state == null) { state = new InOutLineMvoState(); (state as InOutLineMvoState).InOutLineId = id; } return(state); }
public async Task <IInOutLineMvoState> GetHistoryStateAsync(InOutLineId inOutLineId, long version) { var idObj = InOutLineMvoProxyUtils.ToIdString(inOutLineId); var uriParameters = new InOutLineMvoHistoryStateUriParameters(); uriParameters.Id = idObj; uriParameters.Version = version.ToString(); var req = new InOutLineMvoHistoryStateGetRequest(uriParameters); var resp = await _ramlClient.InOutLineMvoHistoryState.Get(req); InOutLineMvoProxyUtils.ThrowOnHttpResponseError(resp); return((resp.Content == null) ? null : resp.Content.ToInOutLineMvoState()); }
public async Task <IInOutLineMvoStateEvent> GetStateEventAsync(InOutLineId inOutLineId, long version) { var idObj = InOutLineMvoProxyUtils.ToIdString(inOutLineId); var uriParameters = new InOutLineMvoStateEventUriParameters(); uriParameters.Id = idObj; uriParameters.Version = version.ToString(); var req = new InOutLineMvoStateEventGetRequest(uriParameters); var resp = await _ramlClient.InOutLineMvoStateEvent.Get(req); InOutLineMvoProxyUtils.ThrowOnHttpResponseError(resp); return(resp.Content); }
public virtual IInOutLineMvoStateEvent GetStateEvent(InOutLineId inOutLineId, long version) { var e = (IInOutLineMvoStateEvent)EventStore.GetStateEvent(ToEventStoreAggregateId(inOutLineId), version); if (e != null) { e.ReadOnly = true; } else if (version == -1) { return(GetStateEvent(inOutLineId, 0)); } return(e); }
public IInOutLineState Get(InOutLineId id, bool nullAllowed) { IInOutLineState state = CurrentSession.Get <InOutLineState>(id); if (!nullAllowed && state == null) { state = new InOutLineState(); (state as InOutLineState).InOutLineId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IInOutLineState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames)); } return(state); }
public async Task <IInOutLineMvoState> GetAsync(InOutLineId inOutLineId) { IInOutLineMvoState state = null; var idObj = InOutLineMvoProxyUtils.ToIdString(inOutLineId); var uriParameters = new InOutLineMvoUriParameters(); uriParameters.Id = idObj; var req = new InOutLineMvoGetRequest(uriParameters); var resp = await _ramlClient.InOutLineMvo.Get(req); InOutLineMvoProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToInOutLineMvoState(); return(state); }
public virtual IInOutLineMvoState Get(InOutLineId inOutLineId) { var state = StateRepository.Get(inOutLineId, true); return(state); }
public virtual IInOutLineMvoState GetHistoryState(InOutLineId inOutLineId, long version) { return(GetHistoryStateAsync(inOutLineId, version).GetAwaiter().GetResult()); }
public IInOutLineMvoStateEvent GetStateEvent(InOutLineId inOutLineId, long version) { return(GetStateEventAsync(inOutLineId, version).GetAwaiter().GetResult()); }
public IInOutLineMvoState Get(InOutLineId inOutLineId) { return(GetAsync(inOutLineId).GetAwaiter().GetResult()); }
public InOutLineMvoEventId(InOutLineId inOutLineId, long inOutVersion) { this._inOutLineId = inOutLineId; this._inOutVersion = inOutVersion; }
public abstract IEventStoreAggregateId ToEventStoreAggregateId(InOutLineId aggregateId);
public virtual IInOutLineMvoState GetHistoryState(InOutLineId inOutLineId, long version) { var eventStream = EventStore.LoadEventStream(typeof(IInOutLineMvoStateEvent), ToEventStoreAggregateId(inOutLineId), version - 1); return(new InOutLineMvoState(eventStream.Events)); }
public override IEventStoreAggregateId ToEventStoreAggregateId(InOutLineId aggregateId) { return(new EventStoreAggregateId(aggregateId)); }
public virtual IInOutLineState GetInOutLine(string inOutDocumentNumber, long lineNumber) { var entityId = new InOutLineId(inOutDocumentNumber, lineNumber); return(CurrentSession.Get <InOutLineState>(entityId)); }