Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        public void Save(IDocumentTypeState state)
        {
            IDocumentTypeState s = state;

            CurrentSession.SaveOrUpdate(s);

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Flush();
        }
Пример #5
0
        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);
        }
Пример #10
0
        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);
        }
Пример #11
0
        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>());
            }
        }
Пример #12
0
 public DocumentTypeAggregate(IDocumentTypeState state)
 {
     _state = state;
 }
Пример #13
0
 public override IDocumentTypeAggregate GetDocumentTypeAggregate(IDocumentTypeState state)
 {
     return(new DocumentTypeAggregate(state));
 }
Пример #14
0
 public DocumentTypeStateDtoWrapper(IDocumentTypeState state)
 {
     this._state = state;
 }
Пример #15
0
 public DocumentTypeStateDtoWrapper()
 {
     this._state = new DocumentTypeState();
 }