src/Orleans.Core.Abstractions/Core/GrainExtensions.cs
/// <summary>
/// Returns the <see langword="long"/> representation of a grain primary key.
/// </summary>
/// <param name="grain">The grain to find the primary key for.</param>
/// <param name="keyExt">The output parameter to return the extended key part of the grain primary key, if extended primary key was provided for that grain.</param>
/// <returns>A <see langword="long"/> representing the primary key for this grain.</returns>
/// <exception cref="InvalidOperationException">The provided grain does not have a <see cref="long"/>-based key.</exception>
Returns the  representation of a grain primary key.
Returns the representation of a grain primary key .
public static long GetPrimaryKeyLong(this IAddressable grain, out string keyExt)
        {
            var grainId = GetGrainId(grain);
            if (grainId.TryGetIntegerKey(out var primaryKey, out keyExt))
            {
                return primaryKey;
            }
            if (LegacyGrainId.TryConvertFromGrainId(grainId, out var legacyId))
            {
                return legacyId.GetPrimaryKeyLong(out keyExt);
            }
            throw new InvalidOperationException($"Unable to extract integer key from grain id {grainId}");
        }
public static long GetPrimaryKeyLong ( this IAddressable grain , out string keyExt ) { var grainId = GetGrainId ( grain ) ; if ( grainId . TryGetIntegerKey ( out var primaryKey , out keyExt ) ) { return primaryKey ; } if ( LegacyGrainId . TryConvertFromGrainId ( grainId , out var legacyId ) ) { return legacyId . GetPrimaryKeyLong ( out keyExt ) ; } throw new InvalidOperationException ( $" Unable to extract integer key from grain id  { grainId } " ) ; }
Returns the  representation of a grain primary key.
Returns the representation of a grain primary key .
A  representing the primary key for this grain.
A representing the primary key for this grain .
The provided grain does not have a -based key.
The provided grain does not have a - based key .
IAddressable
this
string
out
grain
The grain to find the primary key for.
The grain to find the primary key for .
keyExt
The output parameter to return the extended key part of the grain primary key, if extended primary key was provided for that grain.
The output parameter to return the extended key part of the grain primary key if extended primary key was provided for that grain .