29 using System.Collections.Generic;
33 namespace OpenSim.Data
36 public static class DBGuid
45 public static UUID FromDB(
object id)
47 if ((
id == null) || (
id == DBNull.Value))
50 if (
id.GetType() == typeof(Guid))
51 return new UUID((Guid)
id);
53 if (
id.GetType() == typeof(byte[]))
55 if (((byte[])
id).Length == 0)
57 else if (((byte[])
id).Length == 16)
58 return new UUID((byte[])
id, 0);
60 else if (
id.GetType() == typeof(
string))
62 if (((
string)
id).Length == 0)
64 else if (((
string)
id).Length == 36)
65 return new UUID((
string)
id);
68 throw new Exception(
"Failed to convert db value to UUID: " +
id.ToString());