/// <summary> /// Creates an absolute urn representing the Resource identitity outside of a REST context /// </summary> /// <param name="urnType">Type of urn to create, either OID or UUID</param> /// <param name="id">The resource's logical id</param> /// <returns></returns> public static ResourceIdentity Build(UrnType urnType, string id) { //if (baseUrn == null) throw Error.ArgumentNull("baseUrn"); //if (!baseUrn.IsAbsoluteUri) throw Error.Argument("baseUrn", "Base must be an absolute path"); //if (!isUrn(baseUrn.OriginalString)) throw Error.Argument("baseUrn", "Base must be a urn:oid: or urn:uuid:"); if (id == null) { throw Error.ArgumentNull("id"); } Uri baseUrn; if (urnType == UrnType.OID) { baseUrn = new Uri("urn:oid:"); } else { baseUrn = new Uri("urn:uuid:"); } return(new ResourceIdentity(baseUrn, null, id, null, ResourceIdentityForm.Urn)); }
/// <summary> /// Creates an absolute urn representing the Resource identitity outside of a REST context /// </summary> /// <param name="urnType">Type of urn to create, either OID or UUID</param> /// <param name="id">The resource's logical id</param> /// <returns></returns> public static ResourceIdentity Build(UrnType urnType, string id) { //if (baseUrn == null) throw Error.ArgumentNull("baseUrn"); //if (!baseUrn.IsAbsoluteUri) throw Error.Argument("baseUrn", "Base must be an absolute path"); //if (!isUrn(baseUrn.OriginalString)) throw Error.Argument("baseUrn", "Base must be a urn:oid: or urn:uuid:"); if (id == null) throw Error.ArgumentNull("id"); Uri baseUrn; if (urnType == UrnType.OID) baseUrn = new Uri("urn:oid:"); else baseUrn = new Uri("urn:uuid:"); return new ResourceIdentity(baseUrn, null, id, null, ResourceIdentityForm.Urn); }