src/Orleans.Core.Abstractions/Core/GrainExtensions.cs
/// <summary>
/// Returns the long representation of a grain primary key.
/// </summary>
/// <param name="grain">The grain to find the primary key for.</param>
/// <returns>A long representing the primary key for this grain.</returns>
Returns the long representation of a grain primary key.
Returns the long representation of a grain primary key .
public static long GetPrimaryKeyLong(this IAddressable grain)
        {
            var grainId = GetGrainId(grain);
            if (grainId.TryGetIntegerKey(out var primaryKey))
            {
                return primaryKey;
            }
            if (LegacyGrainId.TryConvertFromGrainId(grainId, out var legacyId))
            {
                return legacyId.GetPrimaryKeyLong();
            }
            throw new InvalidOperationException($"Unable to extract integer key from grain id {grainId}");
        }
public static long GetPrimaryKeyLong ( this IAddressable grain ) { var grainId = GetGrainId ( grain ) ; if ( grainId . TryGetIntegerKey ( out var primaryKey ) ) { return primaryKey ; } if ( LegacyGrainId . TryConvertFromGrainId ( grainId , out var legacyId ) ) { return legacyId . GetPrimaryKeyLong ( ) ; } throw new InvalidOperationException ( $" Unable to extract integer key from grain id  { grainId } " ) ; }
Returns the long representation of a grain primary key.
Returns the long representation of a grain primary key .
A long representing the primary key for this grain.
A long representing the primary key for this grain .
IAddressable
this
grain
The grain to find the primary key for.
The grain to find the primary key for .