public override EventStream LoadEventStream(Type eventType, IEventStoreAggregateId eventStoreAggregateId, long version) { Type supportedEventType = typeof(AttributeSetInstanceExtensionFieldMvoStateEventBase); if (!eventType.IsAssignableFrom(supportedEventType)) { throw new NotSupportedException(); } AttributeSetInstanceExtensionFieldId idObj = (AttributeSetInstanceExtensionFieldId)(eventStoreAggregateId as EventStoreAggregateId).Id; var criteria = CurrentSession.CreateCriteria <AttributeSetInstanceExtensionFieldMvoStateEventBase>(); criteria.Add(Restrictions.Eq("StateEventId.AttributeSetInstanceExtensionFieldIdGroupId", idObj.GroupId)); criteria.Add(Restrictions.Eq("StateEventId.AttributeSetInstanceExtensionFieldIdIndex", idObj.Index)); criteria.Add(Restrictions.Le("StateEventId.AttrSetInstEFGroupVersion", version)); criteria.AddOrder(Order.Asc("StateEventId.AttrSetInstEFGroupVersion")); var es = criteria.List <IEvent>(); foreach (AttributeSetInstanceExtensionFieldMvoStateEventBase e in es) { e.StateEventReadOnly = true; } return(new EventStream() { SteamVersion = es.Count > 0 ? ((AttributeSetInstanceExtensionFieldMvoStateEventBase)es.Last()).StateEventId.AttrSetInstEFGroupVersion : default(long), Events = es }); }
public static string ToIdString(AttributeSetInstanceExtensionFieldId id) { var formatter = new AttributeSetInstanceExtensionFieldIdFlattenedDtoFormatter(); var idDto = new AttributeSetInstanceExtensionFieldIdFlattenedDto(id); var idStr = formatter.ToString(idDto); return(idStr); }
public IAttributeSetInstanceExtensionFieldMvoState Get(AttributeSetInstanceExtensionFieldId id) { IAttributeSetInstanceExtensionFieldMvoState state = CurrentSession.Get <AttributeSetInstanceExtensionFieldMvoState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IAttributeSetInstanceExtensionFieldMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public IAttributeSetInstanceExtensionFieldState Get(AttributeSetInstanceExtensionFieldId id) { IAttributeSetInstanceExtensionFieldState state = CurrentSession.Get <AttributeSetInstanceExtensionFieldState>(id); if (state == null) { state = new AttributeSetInstanceExtensionFieldState(); (state as AttributeSetInstanceExtensionFieldState).AttributeSetInstanceExtensionFieldId = id; } return(state); }
public IAttributeSetInstanceExtensionFieldMvoState Get(AttributeSetInstanceExtensionFieldId id, bool nullAllowed) { IAttributeSetInstanceExtensionFieldMvoState state = CurrentSession.Get <AttributeSetInstanceExtensionFieldMvoState> (id); if (!nullAllowed && state == null) { state = new AttributeSetInstanceExtensionFieldMvoState(); (state as AttributeSetInstanceExtensionFieldMvoState).AttributeSetInstanceExtensionFieldId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IAttributeSetInstanceExtensionFieldMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public async Task <IAttributeSetInstanceExtensionFieldMvoState> GetAsync(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId) { IAttributeSetInstanceExtensionFieldMvoState state = null; var idObj = AttributeSetInstanceExtensionFieldMvoProxyUtils.ToIdString(attributeSetInstanceExtensionFieldId); var uriParameters = new AttributeSetInstanceExtensionFieldMvoUriParameters(); uriParameters.Id = idObj; var req = new AttributeSetInstanceExtensionFieldMvoGetRequest(uriParameters); var resp = await _ramlClient.AttributeSetInstanceExtensionFieldMvo.Get(req); AttributeSetInstanceExtensionFieldMvoProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToAttributeSetInstanceExtensionFieldMvoState(); return(state); }
public virtual IAttributeSetInstanceExtensionFieldState GetAttributeSetInstanceExtensionField(string groupId, string index) { var entityId = new AttributeSetInstanceExtensionFieldId(groupId, index); return(CurrentSession.Get <AttributeSetInstanceExtensionFieldState>(entityId)); }
public virtual IAttributeSetInstanceExtensionFieldMvoState GetHistoryState(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId, long version) { return(GetHistoryStateAsync(attributeSetInstanceExtensionFieldId, version).GetAwaiter().GetResult()); }
public async Task <IAttributeSetInstanceExtensionFieldMvoState> GetHistoryStateAsync(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId, long version) { var idObj = AttributeSetInstanceExtensionFieldMvoProxyUtils.ToIdString(attributeSetInstanceExtensionFieldId); var uriParameters = new AttributeSetInstanceExtensionFieldMvoHistoryStateUriParameters(); uriParameters.Id = idObj; uriParameters.Version = version.ToString(); var req = new AttributeSetInstanceExtensionFieldMvoHistoryStateGetRequest(uriParameters); var resp = await _ramlClient.AttributeSetInstanceExtensionFieldMvoHistoryState.Get(req); AttributeSetInstanceExtensionFieldMvoProxyUtils.ThrowOnHttpResponseError(resp); return((resp.Content == null) ? null : resp.Content.ToAttributeSetInstanceExtensionFieldMvoState()); }
public virtual IAttributeSetInstanceExtensionFieldMvoState GetHistoryState(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId, long version) { var eventStream = EventStore.LoadEventStream(typeof(IAttributeSetInstanceExtensionFieldMvoStateEvent), ToEventStoreAggregateId(attributeSetInstanceExtensionFieldId), version - 1); return(new AttributeSetInstanceExtensionFieldMvoState(eventStream.Events)); }
public IAttributeSetInstanceExtensionFieldMvoState Get(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId) { return(GetAsync(attributeSetInstanceExtensionFieldId).GetAwaiter().GetResult()); }
public virtual IAttributeSetInstanceExtensionFieldMvoState Get(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId) { var state = StateRepository.Get(attributeSetInstanceExtensionFieldId, true); return(state); }
public abstract IEventStoreAggregateId ToEventStoreAggregateId(AttributeSetInstanceExtensionFieldId aggregateId);
public AttributeSetInstanceExtensionFieldMvoStateEventId(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId, long attrSetInstEFGroupVersion) { this._attributeSetInstanceExtensionFieldId = attributeSetInstanceExtensionFieldId; this._attrSetInstEFGroupVersion = attrSetInstEFGroupVersion; }
public IAttributeSetInstanceExtensionFieldMvoStateEvent GetStateEvent(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId, long version) { return(GetStateEventAsync(attributeSetInstanceExtensionFieldId, version).GetAwaiter().GetResult()); }
public override IEventStoreAggregateId ToEventStoreAggregateId(AttributeSetInstanceExtensionFieldId aggregateId) { return(new EventStoreAggregateId(aggregateId)); }
public virtual IAttributeSetInstanceExtensionFieldMvoStateEvent GetStateEvent(AttributeSetInstanceExtensionFieldId attributeSetInstanceExtensionFieldId, long version) { var e = (IAttributeSetInstanceExtensionFieldMvoStateEvent)EventStore.GetStateEvent(ToEventStoreAggregateId(attributeSetInstanceExtensionFieldId), version); if (e != null) { e.ReadOnly = true; } else if (version == -1) { return(GetStateEvent(attributeSetInstanceExtensionFieldId, 0)); } return(e); }