/// <summary>
 ///     Construct my default state.
 /// </summary>
 /// <param name="id">Unique identity of this entity</param>
 protected ObjectEntity(string?id)
 {
     Id    = !string.IsNullOrWhiteSpace(id) ? id : Address.IdString;
     _info = Info();
     _persistResultInterest = SelfAs <IPersistResultInterest>();
     _queryResultInterest   = SelfAs <IQueryResultInterest>();
 }
 public void PersistAll <TState, TSource>(IEnumerable <StateSources <TState, TSource> > allStateSources,
                                          IPersistResultInterest interest)
     where TState : StateObject where TSource : ISource
 {
     if (!actor.IsStopped)
     {
         Action <IObjectStore> cons542297984 = __ =>
                                               __.PersistAll(allStateSources, interest);
         if (mailbox.IsPreallocated)
         {
             mailbox.Send(actor, cons542297984, null, PersistAllRepresentation17);
         }
         else
         {
             mailbox.Send(new LocalMessage <IObjectStore>(actor,
                                                          cons542297984, PersistAllRepresentation17));
         }
     }
     else
     {
         actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, PersistAllRepresentation17));
     }
 }
 public void Persist <TState, TSource>(StateSources <TState, TSource> stateSources,
                                       Metadata metadata, long updateId, IPersistResultInterest interest,
                                       object? @object) where TState : StateObject where TSource : ISource
 {
     if (!actor.IsStopped)
     {
         Action <IObjectStore> cons1567165775 = __ =>
                                                __.Persist(stateSources, metadata, updateId, interest, @object);
         if (mailbox.IsPreallocated)
         {
             mailbox.Send(actor, cons1567165775, null, PersistRepresentation16);
         }
         else
         {
             mailbox.Send(new LocalMessage <IObjectStore>(actor,
                                                          cons1567165775, PersistRepresentation16));
         }
     }
     else
     {
         actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, PersistRepresentation16));
     }
 }
 public void Persist <TState, TSource>(StateSources <TState, TSource> stateSources, long updateId,
                                       IPersistResultInterest interest)
     where TState : StateObject where TSource : ISource
 {
     if (!actor.IsStopped)
     {
         Action <IObjectStore> cons440866163 = __ =>
                                               __.Persist(stateSources, updateId, interest);
         if (mailbox.IsPreallocated)
         {
             mailbox.Send(actor, cons440866163, null, PersistRepresentation13);
         }
         else
         {
             mailbox.Send(new LocalMessage <IObjectStore>(actor,
                                                          cons440866163, PersistRepresentation13));
         }
     }
     else
     {
         actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, PersistRepresentation13));
     }
 }
 public void PersistAll <TState, TSource>(IEnumerable <StateSources <TState, TSource> > allStateSources,
                                          Metadata metadata, long updateId, IPersistResultInterest interest,
                                          object? @object) where TState : StateObject where TSource : ISource
 {
     if (!actor.IsStopped)
     {
         Action <IObjectStore> cons129016173 = __ =>
                                               __.PersistAll(allStateSources, metadata, updateId, interest, @object);
         if (mailbox.IsPreallocated)
         {
             mailbox.Send(actor, cons129016173, null, PersistAllRepresentation24);
         }
         else
         {
             mailbox.Send(new LocalMessage <IObjectStore>(actor,
                                                          cons129016173, PersistAllRepresentation24));
         }
     }
     else
     {
         actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, PersistAllRepresentation24));
     }
 }
 public void Persist <TState, TSource>(StateSources <TState, TSource> stateSources,
                                       Metadata metadata, IPersistResultInterest interest)
     where TState : StateObject where TSource : ISource
 {
     if (!actor.IsStopped)
     {
         Action <IObjectStore> cons297809971 = __ =>
                                               __.Persist(stateSources, metadata, interest);
         if (mailbox.IsPreallocated)
         {
             mailbox.Send(actor, cons297809971, null, PersistRepresentation10);
         }
         else
         {
             mailbox.Send(new LocalMessage <IObjectStore>(actor,
                                                          cons297809971, PersistRepresentation10));
         }
     }
     else
     {
         actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, PersistRepresentation10));
     }
 }
 public void Persist <TState, TSource>(StateSources <TState, TSource> stateSources,
                                       IPersistResultInterest interest, object? @object)
     where TState : StateObject where TSource : ISource
 {
     if (!actor.IsStopped)
     {
         Action <IObjectStore> cons1425279528 = __ =>
                                                __.Persist(stateSources, interest, @object);
         if (mailbox.IsPreallocated)
         {
             mailbox.Send(actor, cons1425279528, null, PersistRepresentation11);
         }
         else
         {
             mailbox.Send(new LocalMessage <IObjectStore>(actor,
                                                          cons1425279528, PersistRepresentation11));
         }
     }
     else
     {
         actor.DeadLetters?.FailedDelivery(new DeadLetter(actor, PersistRepresentation11));
     }
 }
Example #8
0
 public void PersistAll <TNewState, TSource>(IEnumerable <TNewState> stateObjects, IEnumerable <TSource> sources, IPersistResultInterest interest) where TNewState : StateObject where TSource : Source =>
 PersistAll(stateObjects, sources, Metadata.NullMetadata(), -1, interest, null);
Example #9
0
 public void PersistAll <TNewState>(IEnumerable <TNewState> stateObjects, Metadata metadata, IPersistResultInterest interest) where TNewState : StateObject
 => PersistAll(stateObjects, Source <TState> .None(), metadata, -1, interest, null);
Example #10
0
        public void Persist <TNewState, TSource>(TNewState stateObject, IEnumerable <TSource> sources, Metadata metadata, long updateId, IPersistResultInterest interest, object? @object) where TNewState : StateObject where TSource : Source
        {
            try
            {
                var raw = _storeDelegate.Persist(stateObject, updateId, metadata);

                var entries      = _entryAdapterProvider.AsEntries <TSource, TEntry>(sources, metadata).ToList();
                var dispatchable = BuildDispatchable(raw, entries);

                _storeDelegate.PersistEntries(entries);
                _storeDelegate.PersistDispatchable(dispatchable);

                Dispatch(dispatchable);
                interest.PersistResultedIn(Success.Of <StorageException, Result>(Result.Success), stateObject, 1, 1, @object);
            }
            catch (StorageException e)
            {
                Logger.Error("Failed to persist all objects", e);
                interest.PersistResultedIn(Failure.Of <StorageException, Result>(e), null, 0, 0, @object);
            }
        }
Example #11
0
 public void Persist <TNewState>(TNewState stateObject, Metadata metadata, long updateId, IPersistResultInterest interest, object? @object) where TNewState : StateObject
 => Persist(stateObject, Source <TState> .None(), metadata, updateId, interest, @object);
Example #12
0
 public void Persist <TNewState, TSource>(TNewState stateObject, IEnumerable <TSource> sources, long updateId, IPersistResultInterest interest)
     where TNewState : StateObject where TSource : Source => Persist(stateObject, sources, Metadata.NullMetadata(), updateId, interest, null);
Example #13
0
 public void Persist <TNewState>(TNewState stateObject, long updateId, IPersistResultInterest interest)
     where TNewState : StateObject => Persist(stateObject, Source <TState> .None(), Metadata.NullMetadata(), updateId, interest, null);
 public void PersistAll <TNewState, TSource>(IEnumerable <StateSources <TNewState, TSource> > allStateSources, IPersistResultInterest interest) where TNewState : StateObject where TSource : ISource =>
 PersistAll(allStateSources, Metadata.NullMetadata(), -1, interest, null);
Example #15
0
        public void PersistAll <TNewState, TSource>(IEnumerable <TNewState> stateObjects, IEnumerable <TSource> sources, Metadata metadata, long updateId, IPersistResultInterest interest, object? @object) where TNewState : StateObject where TSource : Source
        {
            try
            {
                var stateObjectsToPersist = stateObjects as TNewState[] ?? stateObjects.ToArray();
                var states = _storeDelegate.PersistAll(stateObjectsToPersist, updateId, metadata);

                var entries = _entryAdapterProvider.AsEntries <TSource, TEntry>(sources, metadata).ToList();

                _storeDelegate.PersistEntries(entries);

                foreach (var state in states)
                {
                    var dispatchable = BuildDispatchable(state, entries);
                    _storeDelegate.PersistDispatchable(dispatchable);
                    //dispatch each persistent object
                    Dispatch(BuildDispatchable(state, entries));
                }

                interest.PersistResultedIn(Success.Of <StorageException, Result>(Result.Success), stateObjects, stateObjectsToPersist.Length, stateObjectsToPersist.Length, @object);
            }
            catch (StorageException e)
            {
                Logger.Error("Failed to persist all objects", e);
                interest.PersistResultedIn(Failure.Of <StorageException, Result>(e), null, 0, 0, @object);
            }
        }
Example #16
0
 public void PersistAll <TNewState>(IEnumerable <TNewState> stateObjects, Metadata metadata, long updateId, IPersistResultInterest interest, object? @object) where TNewState : StateObject
 => PersistAll(stateObjects, Source <TState> .None(), metadata, updateId, interest, @object);
Example #17
0
 public void PersistAll <TNewState>(IEnumerable <TNewState> stateObjects, long updateId, IPersistResultInterest interest) where TNewState : StateObject
 => PersistAll(stateObjects, Source <TState> .None(), Metadata.NullMetadata(), updateId, interest, null);
 public void Persist <TNewState, TSource>(StateSources <TNewState, TSource> stateSources, IPersistResultInterest interest) where TNewState : StateObject where TSource : ISource
 => Persist(stateSources, Metadata.NullMetadata(), -1, interest, null);
        public void PersistAll <TNewState, TSource>(IEnumerable <StateSources <TNewState, TSource> > allStateSources, Metadata metadata, long updateId, IPersistResultInterest interest, object? @object) where TNewState : StateObject where TSource : ISource
        {
            var allPersistentObjects = new List <TNewState>();

            try
            {
                foreach (var stateSources in allStateSources)
                {
                    var stateObject = stateSources.StateObject;
                    var state       = _storeDelegate.Persist(stateObject, updateId, metadata);
                    allPersistentObjects.Add(stateObject);

                    var entryVersion = (int)stateSources.StateObject.Version;
                    var entries      = _entryAdapterProvider.AsEntries <TSource, IEntry <T> >(stateSources.Sources, entryVersion, metadata).ToList();
                    _storeDelegate.PersistEntries(entries);

                    var dispatchable = BuildDispatchable(state, entries);
                    _storeDelegate.PersistDispatchable(dispatchable);

                    Dispatch(BuildDispatchable(state, entries));
                }

                interest.PersistResultedIn(Success.Of <StorageException, Result>(Result.Success), allPersistentObjects, allPersistentObjects.Count, allPersistentObjects.Count, @object);
            }
            catch (StorageException e)
            {
                Logger.Error("Failed to persist all objects", e);
                interest.PersistResultedIn(Failure.Of <StorageException, Result>(e), null, 0, 0, @object);
            }
        }
 public void PersistAll <TNewState, TSource>(IEnumerable <StateSources <TNewState, TSource> > allStateSources, Metadata metadata, long updateId, IPersistResultInterest interest) where TNewState : StateObject where TSource : ISource
 => PersistAll(allStateSources, metadata, updateId, interest, null);
 public void PersistAll <TNewState, TSource>(IEnumerable <StateSources <TNewState, TSource> > allStateSources, Metadata metadata, IPersistResultInterest interest, object? @object) where TNewState : StateObject where TSource : ISource
 => PersistAll(allStateSources, metadata, -1, interest, @object);
Example #22
0
 public void PersistAll <TNewState>(IEnumerable <TNewState> stateObjects, IPersistResultInterest interest, object? @object) where TNewState : StateObject
 => PersistAll(stateObjects, Source <TState> .None(), Metadata.NullMetadata(), -1, interest, @object);
Example #23
0
 public void PersistAll <TNewState, TSource>(IEnumerable <TNewState> stateObjects, IEnumerable <TSource> sources, Metadata metadata, IPersistResultInterest interest, object? @object) where TNewState : StateObject where TSource : Source
 => PersistAll(stateObjects, sources, metadata, -1, interest, @object);
 public void Persist <TNewState, TSource>(StateSources <TNewState, TSource> stateSources, long updateId, IPersistResultInterest interest, object? @object) where TNewState : StateObject where TSource : ISource
 => Persist(stateSources, Metadata.NullMetadata(), updateId, interest, @object);
Example #25
0
 public void PersistAll <TNewState, TSource>(IEnumerable <TNewState> stateObjects, IEnumerable <TSource> sources, Metadata metadata, long updateId, IPersistResultInterest interest) where TNewState : StateObject where TSource : Source
 => PersistAll(stateObjects, sources, metadata, updateId, interest, null);
Example #26
0
 public void Persist <TNewState, TSource>(TNewState stateObject, IEnumerable <TSource> sources, Metadata metadata, IPersistResultInterest interest) where TNewState : StateObject where TSource : Source
 => Persist(stateObject, sources, metadata, -1, interest, null);
Example #27
0
 public void PersistAll <TNewState, TSource>(IEnumerable <TNewState> stateObjects, IEnumerable <TSource> sources, long updateId, IPersistResultInterest interest, object? @object) where TNewState : StateObject where TSource : Source
 => PersistAll(stateObjects, sources, Metadata.NullMetadata(), updateId, interest, @object);
Example #28
0
 public void Persist <TNewState>(TNewState stateObject, IPersistResultInterest interest, object? @object)
     where TNewState : StateObject => Persist(stateObject, Source <TState> .None(), Metadata.NullMetadata(), -1, interest, @object);
Example #29
0
 public void Persist <TNewState>(TNewState stateObject, Metadata metadata, IPersistResultInterest interest)
     where TNewState : StateObject => Persist(stateObject, Source <TState> .None(), metadata, -1, interest, null);
Example #30
0
 public void Persist <TNewState, TSource>(TNewState stateObject, IEnumerable <TSource> sources, IPersistResultInterest interest, object? @object) where TNewState : StateObject where TSource : Source
 => Persist(stateObject, sources, Metadata.NullMetadata(), -1, interest, @object);