/// <summary>
        /// Creates a UDI from a given entity type.
        /// </summary>
        /// <param name="type">The UDI type</param>
        /// <returns>The <see cref="Udi"/>.</returns>
        public static Udi CreateUdi(UdiEntityType type)
        {
            if (type.Type != UdiType.Open)
            {
                throw new ArgumentException(nameof(type));
            }

            return(new Udi(type.Value));
        }
        /// <summary>
        /// Creates a UDI from a given entity type and string id.
        /// </summary>
        /// <param name="type">The UDI type</param>
        /// <param name="id">The entity id.</param>
        /// <returns>The <see cref="Udi"/>.</returns>
        public static Udi CreateUdi(UdiEntityType type, string id)
        {
            if (type.Type != UdiType.ClosedString)
            {
                throw new ArgumentException(nameof(type));
            }

            return(new Udi(type.Value, id));
        }
Ejemplo n.º 3
0
        private Udi(UdiEntityType entityType, string id, Guid guid)
        {
            if (entityType.Type != UdiType.Open && string.IsNullOrWhiteSpace(id))
            {
                throw new ArgumentException(nameof(id));
            }

            this.EntityType = entityType;
            this.Id         = Uri.EscapeDataString(id).Replace("%2F", "/");
            this.guid       = guid;
        }