Exemplo n.º 1
0
 /// <summary>
 /// Converts the <see cref="Guid"/> to a UUID instance.
 /// </summary>
 /// <typeparam name="TUuid">The concrete UUID type.</typeparam>
 /// <param name="guid">The unique identifier.</param>
 /// <returns>A new UUID instance.</returns>
 public static TUuid ToUuid <TUuid>(this Guid guid)
     where TUuid : class, IUuid, new()
 {
     return(new TUuid
     {
         Value = GuidUtility.GetSwappedBytes(guid.ToByteArray()),
     });
 }
Exemplo n.º 2
0
 /// <summary>
 /// Converts the UUID to a <see cref="Guid"/> instance.
 /// </summary>
 /// <param name="uuid">The UUID.</param>
 /// <returns>A new <see cref="Guid"/> instance.</returns>
 public static Guid ToGuid(this IUuid uuid)
 {
     return(!uuid.IsValidGuid()
          ? default(Guid)
          : new Guid(GuidUtility.GetSwappedBytes(uuid.Value)));
 }