Пример #1
0
 /// <summary>
 /// Turn the given snapshot definition into an unique filename
 /// </summary>
 /// <param name="snapshot">
 /// The snapshot definition to be saved or read
 /// </param>
 /// <remarks>
 /// The filename is the sequence number with the rest of the snapshot definition
 /// going into the folder path
 /// </remarks>
 public static string MakeSnapshotFilename(ISnapshot snapshot)
 {
     if (snapshot != null)
     {
         return(BlobEventStreamBase.MakeValidStorageFolderName($"{snapshot.CurrentSequenceNumber}"));
     }
     return(string.Empty);
 }
Пример #2
0
 /// <summary>
 /// Make a folder path in which a snapshot for a projection can be saved
 /// </summary>
 /// <param name="snapshot"></param>
 /// <returns></returns>
 public static string MakeSnapshotFolder(ISnapshot snapshot)
 {
     if (snapshot != null)
     {
         return(BlobEventStreamBase.MakeValidStorageFolderName($"{snapshot.DomainName}/{snapshot.EntityTypeName}/{snapshot.InstanceKey}"));
     }
     return(string.Empty);
 }
Пример #3
0
        /// <summary>
        /// Turn the identity of an event stream backed entity into the name of a
        /// queue down which the notifications about that entity should be posted
        /// </summary>
        /// <param name="targetEntity">
        /// The entity for which a notification has occurred
        /// </param>
        /// <returns></returns>
        public static string MakeQueueName(IEventStreamIdentity targetEntity)
        {
            if (targetEntity != null)
            {
                string basename = BlobEventStreamBase.MakeValidStorageFolderName($"{targetEntity.DomainName}-{targetEntity.EntityTypeName}");
                // Queues also cannot start with a number
                return(basename.TrimStart(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }));
            }

            // The target that applies if the entity cannot be identified
            return($"unidentified-entities");
        }