Create a unique identifier that is a recognizable child of the parent identifier

When creating a set of elements identified by pointers, I decided to use child elements that share the first 12 characters (6 bytes) of their identifier with their parent and child identifiers.

For instance:

Parent Id: df2f5d11-0b66-4407-8cf4-8877b954a273
Child Id: df2f5d11-0b66-349b-8527-1a6a79d2efce

I know that many models use a similar mechanism for related objects, so I wonder if there are prescribed guidelines or conventions for recognizable unique identifiers.

My implementation is as follows:

var childId = new Guid(parentId.ToByteArray().Take(6).Concat(Guid.NewGuid().ToByteArray().Take(10)).ToArray());

- which seems a little awkward to me if many systems use a similar mechanism.

Is there a better / cleaner / easier way?

+3
1

, GUID , .

, , , .

, , ?

+1

All Articles