src/Orleans.Core.Abstractions/IDs/ActivationId.cs
/// <summary>
/// Returns an activation id which has been computed deterministically and reproducibly from the provided grain id.
/// </summary>
/// <param name="grain">The grain id.</param>
/// <returns>An activation id which has been computed deterministically and reproducibly from the provided grain id.</returns>
Returns an activation id which has been computed deterministically and reproducibly from the provided grain id.
Returns an activation id which has been computed deterministically and reproducibly from the provided grain id .
public static ActivationId GetDeterministic(GrainId grain)
        {
            Span<byte> temp = stackalloc byte[16];
            var a = (ulong)grain.Type.GetUniformHashCode();
            var b = (ulong)grain.Key.GetUniformHashCode();
            BinaryPrimitives.WriteUInt64LittleEndian(temp, a);
            BinaryPrimitives.WriteUInt64LittleEndian(temp[8..], b);
            var key = new Guid(temp);
            return new ActivationId(key);
        }
public static ActivationId GetDeterministic ( GrainId grain ) { Span < byte > temp = stackalloc byte [ 16 ] ; var a = ( ulong ) grain . Type . GetUniformHashCode ( ) ; var b = ( ulong ) grain . Key . GetUniformHashCode ( ) ; BinaryPrimitives . WriteUInt64LittleEndian ( temp , a ) ; BinaryPrimitives . WriteUInt64LittleEndian ( temp [ 8 .. ] , b ) ; var key = new Guid ( temp ) ; return new ActivationId ( key ) ; }
Returns an activation id which has been computed deterministically and reproducibly from the provided grain id.
Returns an activation id which has been computed deterministically and reproducibly from the provided grain id .
An activation id which has been computed deterministically and reproducibly from the provided grain id.
An activation id which has been computed deterministically and reproducibly from the provided grain id .
grain
GrainId
The grain id.
The grain id .