public virtual IEvent GetEvent(IEventStoreAggregateId eventStoreAggregateId, long version)
        {
            object idObj = ((EventStoreAggregateId)eventStoreAggregateId).Id;
            AttributeSetInstanceState state = CurrentSession.Get <AttributeSetInstanceState>(idObj);

            return(new AttributeSetInstanceStateCreated(state));
        }
        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 static IEnumerable <IAttributeSetInstanceState> ToAttributeSetInstanceStateCollection(IEnumerable <string> ids)
        {
            var states = new List <AttributeSetInstanceState>();

            foreach (var id in ids)
            {
                var s = new AttributeSetInstanceState();
                s.AttributeSetInstanceId = id;
                states.Add(s);
            }
            return(states);
        }
        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);
        }
        public void AppendEvents(IEventStoreAggregateId eventStoreAggregateId, long version, ICollection <IEvent> events, Action afterEventsAppended)
        {
            foreach (IEvent e in events)
            {
                if (e is AttributeSetInstanceStateCreated)
                {
                    AttributeSetInstanceState s = ((AttributeSetInstanceStateCreated)e).AttributeSetInstanceState;
                    CurrentSession.Save(s);
                }
                else
                {
                    CurrentSession.Save(e);
                }
                var saveable = e as ISaveable;
                if (saveable != null)
                {
                    saveable.Save();
                }
            }

            //Console.WriteLine("####################################################");
            afterEventsAppended();
            //Console.WriteLine("####################################################");
        }
示例#6
0
 public static CreateAttributeSetInstance ToCreateAttributeSetInstance(this AttributeSetInstanceState state)
 {
     return(state.ToCreateAttributeSetInstance <CreateAttributeSetInstance>());
 }
示例#7
0
 public static MergePatchAttributeSetInstance ToMergePatchAttributeSetInstance(this AttributeSetInstanceState state)
 {
     return(state.ToMergePatchAttributeSetInstance <MergePatchAttributeSetInstance>());
 }
示例#8
0
 public static DeleteAttributeSetInstance ToDeleteAttributeSetInstance(this AttributeSetInstanceState state)
 {
     return(state.ToDeleteAttributeSetInstance <DeleteAttributeSetInstance>());
 }
示例#9
0
 public static IAttributeSetInstanceCommand ToCreateOrMergePatchAttributeSetInstance(this AttributeSetInstanceState state)
 {
     return(state.ToCreateOrMergePatchAttributeSetInstance <CreateAttributeSetInstance, MergePatchAttributeSetInstance>());
 }