Skip to content

GrainFactoryExtensions Methods

Provides extension methods for creating grain references.

GetGrain(IGrainFactory, IdSpan)

staticextension
View source
public static TGrainInterface GetGrain<TGrainInterface>(this IGrainFactory grainFactory, IdSpan grainPrimaryKey)
Returns a reference for the provided grain id which implements the specified interface type.

Parameters

grainFactoryIGrainFactory
The grain factory.
grainPrimaryKeyIdSpan
The primary key of the grain

Returns

A reference for the provided grain id which implements the specified interface type.

GetGrain(IGrainFactory, IdSpan, string)

staticextension
View source
public static TGrainInterface GetGrain<TGrainInterface>(this IGrainFactory grainFactory, IdSpan grainPrimaryKey, string grainClassNamePrefix)
Returns a reference for the provided grain id which implements the specified interface type.

Parameters

grainFactoryIGrainFactory
The grain factory.
grainPrimaryKeyIdSpan
The primary key of the grain
grainClassNamePrefixstring
An optional class name prefix used to find the runtime type of the grain.

Returns

A reference for the provided grain id which implements the specified interface type.