GetTypeName() public static method

Gets the given type's name as a string.
public static GetTypeName ( Type type ) : string
type System.Type The type to get the name of.
return string
Example #1
0
        /// <summary>
        /// Enqueues a job for the given application name and queue name.
        /// </summary>
        /// <param name="applicationName">The name of the application to enqueue the job for.</param>
        /// <param name="queueName">The name of the queue to enqueue the job on, or null for the default queue.</param>
        /// <param name="repository">The repository to use when enqueueing the job record.</param>
        public virtual void Enqueue(string applicationName, string queueName, IRepository repository)
        {
            if (string.IsNullOrEmpty(applicationName))
            {
                throw new ArgumentNullException("applicationName", "applicationName must contain a value.");
            }

            if (string.IsNullOrEmpty(queueName))
            {
                queueName = "*";
            }

            if (repository == null)
            {
                throw new ArgumentNullException("repository", "repository cannot be null.");
            }

            QueueRecord record = new QueueRecord()
            {
                ApplicationName = applicationName,
                Data            = JobSerializer.Serialize(this),
                JobName         = this.Name,
                JobType         = JobSerializer.GetTypeName(this),
                QueuedOn        = DateTime.UtcNow,
                QueueName       = queueName,
                TryNumber       = 1
            };

            repository.CreateQueued(record, null);
        }