public static TDeleteDocumentType ToDeleteDocumentType <TDeleteDocumentType>(this IDocumentTypeState state) where TDeleteDocumentType : IDeleteDocumentType, new() { var cmd = new TDeleteDocumentType(); cmd.DocumentTypeId = state.DocumentTypeId; cmd.Version = ((IDocumentTypeStateProperties)state).Version; return(cmd); }
public IDocumentTypeState Get(string id, bool nullAllowed) { IDocumentTypeState state = CurrentSession.Get <DocumentTypeState> (id); if (!nullAllowed && state == null) { state = new DocumentTypeState(); (state as DocumentTypeState).DocumentTypeId = id; } return(state); }
public static TCreateDocumentType ToCreateDocumentType <TCreateDocumentType>(this IDocumentTypeState state) where TCreateDocumentType : ICreateDocumentType, new() { var cmd = new TCreateDocumentType(); cmd.Version = ((IDocumentTypeStateProperties)state).Version; cmd.DocumentTypeId = state.DocumentTypeId; cmd.Description = state.Description; cmd.ParentDocumentTypeId = state.ParentDocumentTypeId; cmd.Active = ((IDocumentTypeStateProperties)state).Active; return(cmd); }
public void Save(IDocumentTypeState state) { IDocumentTypeState s = state; CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Flush(); }
public async Task <IDocumentTypeState> GetAsync(string documentTypeId) { IDocumentTypeState state = null; var idObj = documentTypeId; var uriParameters = new DocumentTypeUriParameters(); uriParameters.Id = idObj; var req = new DocumentTypeGetRequest(uriParameters); var resp = await _ramlClient.DocumentType.Get(req); DocumentTypeProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToDocumentTypeState(); return(state); }
protected bool IsRepeatedCommand(IDocumentTypeCommand command, IEventStoreAggregateId eventStoreAggregateId, IDocumentTypeState state) { bool repeated = false; if (((IDocumentTypeStateProperties)state).Version == command.AggregateVersion + 1) { if (state.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IDocumentTypeAggregate aggregate, IDocumentTypeState state) { StateRepository.Save(state); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IDocumentTypeAggregate, IDocumentTypeState>(aggregate, state, aggregate.Changes)); } }
public abstract IDocumentTypeAggregate GetDocumentTypeAggregate(IDocumentTypeState state);
public IDocumentTypeState Get(string id) { IDocumentTypeState state = CurrentSession.Get <DocumentTypeState>(id); return(state); }
public static TMergePatchDocumentType ToMergePatchDocumentType <TMergePatchDocumentType>(this IDocumentTypeState state) where TMergePatchDocumentType : IMergePatchDocumentType, new() { var cmd = new TMergePatchDocumentType(); cmd.Version = ((IDocumentTypeStateProperties)state).Version; cmd.DocumentTypeId = state.DocumentTypeId; cmd.Description = state.Description; cmd.ParentDocumentTypeId = state.ParentDocumentTypeId; cmd.Active = ((IDocumentTypeStateProperties)state).Active; if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } if (state.ParentDocumentTypeId == null) { cmd.IsPropertyParentDocumentTypeIdRemoved = true; } return(cmd); }
public static IDocumentTypeCommand ToCreateOrMergePatchDocumentType <TCreateDocumentType, TMergePatchDocumentType>(this IDocumentTypeState state) where TCreateDocumentType : ICreateDocumentType, new() where TMergePatchDocumentType : IMergePatchDocumentType, new() { bool bUnsaved = ((IDocumentTypeState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateDocumentType <TCreateDocumentType>()); } else { return(state.ToMergePatchDocumentType <TMergePatchDocumentType>()); } }
public DocumentTypeAggregate(IDocumentTypeState state) { _state = state; }
public override IDocumentTypeAggregate GetDocumentTypeAggregate(IDocumentTypeState state) { return(new DocumentTypeAggregate(state)); }
public DocumentTypeStateDtoWrapper(IDocumentTypeState state) { this._state = state; }
public DocumentTypeStateDtoWrapper() { this._state = new DocumentTypeState(); }