Skip to content

GrainIdKeyExtensions Methods

Extensions for GrainId keys.

CreateGuidKey(Guid, ReadOnlySpan<byte>)

static
View source
public static IdSpan CreateGuidKey(Guid key, ReadOnlySpan<byte> keyExtension)
Creates an IdSpan representing a System.Guid key and key extension string.

Parameters

keyGuid
The key.
keyExtensionReadOnlySpan<byte>
The UTF-8 encoded key extension.

Returns

An IdSpan representing the provided key and key extension.

CreateGuidKey(Guid, string?)

static
View source
public static IdSpan CreateGuidKey(Guid key, string? keyExtension)
Creates an IdSpan representing a System.Guid key and key extension string.

Parameters

keyGuid
The key.
keyExtensionstring?
The key extension.

Returns

An IdSpan representing the provided key and key extension.

CreateIntegerKey(long, ReadOnlySpan<byte>)

static
View source
public static IdSpan CreateIntegerKey(long key, ReadOnlySpan<byte> keyExtension)
Creates an IdSpan representing a System.Int64 key and key extension string.

Parameters

keylong
The key.
keyExtensionReadOnlySpan<byte>
The UTF-8 encoded key extension.

Returns

An IdSpan representing the provided key and key extension.

CreateIntegerKey(long, string?)

static
View source
public static IdSpan CreateIntegerKey(long key, string? keyExtension)
Creates an IdSpan representing a System.Int64 key and key extension string.

Parameters

keylong
The key.
keyExtensionstring?
The key extension.

Returns

An IdSpan representing the provided key and key extension.

GetGuidKey(GrainId)

staticextension
View source
public static Guid GetGuidKey(this GrainId grainId)
Returns the System.Guid representation of a grain primary key.

Parameters

grainIdGrainId
The grain to find the primary key for.

Returns

A System.Guid representing the primary key for this grain.

GetGuidKey(GrainId, string?)

staticextension
View source
public static Guid GetGuidKey(this GrainId grainId, out string? keyExt)
Returns the System.Guid representation of a grain primary key.

Parameters

grainIdGrainId
The grain to find the primary key for.
keyExtstring?
The output parameter to return the extended key part of the grain primary key, if extended primary key was provided for that grain.

Returns

A System.Guid representing the primary key for this grain.

GetIntegerKey(GrainId)

staticextension
View source
public static long GetIntegerKey(this GrainId grainId)
Returns the System.Int64 representation of a grain key.

Parameters

grainIdGrainId
The grain to find the key for.

Returns

A System.Int64 representing the key for this grain.

GetIntegerKey(GrainId, string?)

staticextension
View source
public static long GetIntegerKey(this GrainId grainId, out string? keyExt)
Returns the System.Int64 representation of a grain key.

Parameters

grainIdGrainId
The grain id.
keyExtstring?
The output parameter to return the extended key part of the grain primary key, if extended primary key was provided for that grain.

Returns

A long representing the key for this grain.

TryGetGuidKey(GrainId, Guid, string?)

staticextension
View source
public static bool TryGetGuidKey(this GrainId grainId, out Guid key, out string? keyExt)
Tries to parse the GrainId portion of the provided grain id to extract a System.Guid key and System.String key extension.

Parameters

grainIdGrainId
The grain id.
keyGuid
The key.
keyExtstring?
The key extension.

Returns

true when the grain id was successfully parsed, false otherwise.

TryGetIntegerKey(GrainId, long, string?)

staticextension
View source
public static bool TryGetIntegerKey(this GrainId grainId, out long key, out string? keyExt)
Tries to parse the GrainId portion of the provided grain id to extract a System.Int64 key and System.String key extension.

Parameters

grainIdGrainId
The grain id.
keylong
The key.
keyExtstring?
The key extension.

Returns

true when the grain id was successfully parsed, false otherwise.