Example #1
0
        public void FromStringShouldReturnCorrectUuid()
        {
            var uuid = Uuid.FromString("e8340f07-e924-40dc-88f6-32fc003c160c");

            Assert.Equal(-1714729031470661412L, uuid.MostSignificantBits);
            Assert.Equal(-8577612382363445748L, uuid.LeastSignificantBits);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlMessageReceiver"/> class.
        /// </summary>
        /// <param name="streamName">The logical name of the associated stream. The name should be unique.</param>
        /// <param name="configuration">The associated <see cref="SqlMessageQueueConfiguration">SQL queue configuration</see>.</param>
        public SqlMessageReceiver(string streamName, SqlMessageQueueConfiguration configuration)
        {
            Arg.NotNullOrEmpty(streamName, nameof(streamName));
            Arg.NotNull(configuration, nameof(configuration));

            Configuration  = configuration;
            SubscriptionId = Uuid.FromString(streamName);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlMessageReceiver"/> class.
        /// </summary>
        /// <param name="configuration">The associated <see cref="SqlMessageQueueConfiguration">SQL queue configuration</see>.</param>
        /// <remarks>This constructor will use the name of entry assembly, calling assembly, and finally the defining assembly,
        /// in that prescedence, as the basis of the subscription identifier.</remarks>
        public SqlMessageReceiver(SqlMessageQueueConfiguration configuration)
        {
            Arg.NotNull(configuration, nameof(configuration));

            var assembly = GetEntryAssembly() ?? GetCallingAssembly() ?? GetType().GetTypeInfo().Assembly;

            Configuration  = configuration;
            SubscriptionId = Uuid.FromString(assembly.GetName().Name);
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlMessageReceiver"/> class.
        /// </summary>
        /// <param name="streamName">The logical name of the associated stream. The name should be unique.</param>
        /// <param name="connectionString">The connection string used by the message receiver.</param>
        public SqlMessageReceiver(string streamName, string connectionString)
        {
            Arg.NotNullOrEmpty(streamName, nameof(streamName));
            Arg.NotNullOrEmpty(connectionString, nameof(connectionString));

            var builder = new SqlMessageQueueConfigurationBuilder().HasConnectionString(connectionString);

            Configuration  = builder.CreateConfiguration();
            SubscriptionId = Uuid.FromString(streamName);
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SqlMessageReceiver"/> class.
        /// </summary>
        /// <param name="connectionString">The connection string used by the message receiver.</param>
        public SqlMessageReceiver(string connectionString)
        {
            Arg.NotNullOrEmpty(connectionString, nameof(connectionString));

            var assembly = GetEntryAssembly() ?? GetCallingAssembly() ?? GetType().GetTypeInfo().Assembly;
            var builder  = new SqlMessageQueueConfigurationBuilder().HasConnectionString(connectionString);

            Configuration  = builder.CreateConfiguration();
            SubscriptionId = Uuid.FromString(assembly.GetName().Name);
        }