public IAttributeSetInstanceState Get(string id)
        {
            IAttributeSetInstanceState state = CurrentSession.Get <AttributeSetInstanceState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IAttributeSetInstanceState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
        public void Save(IAttributeSetInstanceState state)
        {
            CurrentSession.SaveOrUpdate(state);

            var saveable = state as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
        public IAttributeSetInstanceState Get(string id)
        {
            IAttributeSetInstanceState state = CurrentSession.Get <AttributeSetInstanceState> (id);

            if (state == null)
            {
                state = new AttributeSetInstanceState();
                (state as AttributeSetInstanceState).AttributeSetInstanceId = id;
            }
            return(state);
        }
        public IAttributeSetInstanceState Get(string id, bool nullAllowed)
        {
            IAttributeSetInstanceState state = CurrentSession.Get <AttributeSetInstanceState> (id);

            if (!nullAllowed && state == null)
            {
                state = new AttributeSetInstanceState();
                (state as AttributeSetInstanceState).AttributeSetInstanceId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IAttributeSetInstanceState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
示例#5
0
        public async Task <IAttributeSetInstanceState> GetAsync(string attributeSetInstanceId)
        {
            IAttributeSetInstanceState state = null;
            var idObj         = attributeSetInstanceId;
            var uriParameters = new AttributeSetInstanceUriParameters();

            uriParameters.Id = idObj;

            var req = new AttributeSetInstanceGetRequest(uriParameters);

            var resp = await _ramlClient.AttributeSetInstance.Get(req);

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);
            state = resp.Content;
            return(state);
        }
        public void Save(IAttributeSetInstanceState state)
        {
            IAttributeSetInstanceState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IAttributeSetInstanceState>(state);
            }
            CurrentSession.SaveOrUpdate(s);

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
        }
示例#7
0
 public override bool Equals(ICreateAttributeSetInstance command, IAttributeSetInstanceState state)
 {
     return(AttributeSetInstancePropertyUtils.Equals(command, state));
 }
示例#8
0
 public override IAttributeSetInstanceAggregate GetAttributeSetInstanceAggregate(IAttributeSetInstanceState state)
 {
     return(new AttributeSetInstanceAggregate(state));
 }
示例#9
0
 public AttributeSetInstanceAggregate(IAttributeSetInstanceState state)
 {
     _state = state;
 }
        protected bool IsRepeatedCommand(IAttributeSetInstanceCommand command, IEventStoreAggregateId eventStoreAggregateId, IAttributeSetInstanceState state)
        {
            bool repeated = false;

            if (((IAttributeSetInstanceStateProperties)state).Version > command.AggregateVersion)
            {
                var lastEvent = EventStore.FindLastEvent(typeof(IAttributeSetInstanceStateEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
 public abstract IAttributeSetInstanceAggregate GetAttributeSetInstanceAggregate(IAttributeSetInstanceState state);
示例#12
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IAttributeSetInstanceAggregate aggregate, IAttributeSetInstanceState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IAttributeSetInstanceStateProperties)state).Version, aggregate.Changes, () => {});
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IAttributeSetInstanceAggregate, IAttributeSetInstanceState>(aggregate, state, aggregate.Changes));
     }
 }