Class GrainExtensions
Extension methods for grains.
Inheritance
Namespace: Orleans
Assembly: Orleans.Core.Abstractions.dll
Syntax
public static class GrainExtensions : object
Methods
| Improve this Doc View SourceAsReference<TGrainInterface>(IAddressable)
Converts this grain to a specific grain interface.
Declaration
public static TGrainInterface AsReference<TGrainInterface>(this IAddressable grain)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The grain to convert. |
Returns
Type | Description |
---|---|
TGrainInterface | A strongly typed |
Type Parameters
Name | Description |
---|---|
TGrainInterface | The type of the grain interface. |
BindGrainReference(IAddressable, IGrainFactory)
Binds the grain reference to the provided IGrainFactory.
Declaration
public static void BindGrainReference(this IAddressable grain, IGrainFactory grainFactory)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The grain reference. |
IGrainFactory | grainFactory | The grain factory. |
Cast<TGrainInterface>(IAddressable)
Casts a grain to a specific grain interface.
Declaration
public static TGrainInterface Cast<TGrainInterface>(this IAddressable grain)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The grain to cast. |
Returns
Type | Description |
---|---|
TGrainInterface |
Type Parameters
Name | Description |
---|---|
TGrainInterface | The type of the grain interface. |
GetGrainIdentity(IGrain)
Declaration
public static IGrainIdentity GetGrainIdentity(this IGrain grain)
Parameters
Type | Name | Description |
---|---|---|
IGrain | grain |
Returns
Type | Description |
---|---|
IGrainIdentity |
GetPrimaryKey(IGrain)
Declaration
public static Guid GetPrimaryKey(this IGrain grain)
Parameters
Type | Name | Description |
---|---|---|
IGrain | grain |
Returns
Type | Description |
---|---|
Guid |
GetPrimaryKey(IGrain, out String)
Declaration
public static Guid GetPrimaryKey(this IGrain grain, out string keyExt)
Parameters
Type | Name | Description |
---|---|---|
IGrain | grain | |
System.String | keyExt |
Returns
Type | Description |
---|---|
Guid |
GetPrimaryKey(IAddressable)
Returns the Guid representation of a grain primary key.
Declaration
public static Guid GetPrimaryKey(this IAddressable grain)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The grain to find the primary key for. |
Returns
Type | Description |
---|---|
Guid | A Guid representing the primary key for this grain. |
GetPrimaryKey(IAddressable, out String)
Returns the Guid representation of a grain primary key.
Declaration
public static Guid GetPrimaryKey(this IAddressable grain, out string keyExt)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The grain to find the primary key for. |
System.String | keyExt | The output paramater to return the extended key part of the grain primary key, if extened primary key was provided for that grain. |
Returns
Type | Description |
---|---|
Guid | A Guid representing the primary key for this grain. |
GetPrimaryKeyLong(IGrain)
Declaration
public static long GetPrimaryKeyLong(this IGrain grain)
Parameters
Type | Name | Description |
---|---|---|
IGrain | grain |
Returns
Type | Description |
---|---|
System.Int64 |
GetPrimaryKeyLong(IGrain, out String)
Declaration
public static long GetPrimaryKeyLong(this IGrain grain, out string keyExt)
Parameters
Type | Name | Description |
---|---|---|
IGrain | grain | |
System.String | keyExt |
Returns
Type | Description |
---|---|
System.Int64 |
GetPrimaryKeyLong(IAddressable)
Returns the long representation of a grain primary key.
Declaration
public static long GetPrimaryKeyLong(this IAddressable grain)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The grain to find the primary key for. |
Returns
Type | Description |
---|---|
System.Int64 | A long representing the primary key for this grain. |
GetPrimaryKeyLong(IAddressable, out String)
Returns the long representation of a grain primary key.
Declaration
public static long GetPrimaryKeyLong(this IAddressable grain, out string keyExt)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The grain to find the primary key for. |
System.String | keyExt | The output paramater to return the extended key part of the grain primary key, if extened primary key was provided for that grain. |
Returns
Type | Description |
---|---|
System.Int64 | A long representing the primary key for this grain. |
GetPrimaryKeyString(IGrainWithStringKey)
Declaration
public static string GetPrimaryKeyString(this IGrainWithStringKey grain)
Parameters
Type | Name | Description |
---|---|---|
IGrainWithStringKey | grain |
Returns
Type | Description |
---|---|
System.String |
GetPrimaryKeyString(IAddressable)
Returns the string primary key of the grain.
Declaration
public static string GetPrimaryKeyString(this IAddressable grain)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The grain to find the primary key for. |
Returns
Type | Description |
---|---|
System.String | A string representing the primary key for this grain. |
InvokeOneWay<T>(T, Func<T, Task>)
Invokes a method of a grain interface is one-way fashion so that no response message will be sent to the caller.
Declaration
public static void InvokeOneWay<T>(this T grainReference, Func<T, Task> grainMethodInvocation)where T : class, IAddressable
Parameters
Type | Name | Description |
---|---|---|
T | grainReference | Grain reference which will be copied and then a call executed on it |
Func<T, Task> | grainMethodInvocation | Function that should invoke grain method and return resulting task |
Type Parameters
Name | Description |
---|---|
T | Grain interface |
IsPrimaryKeyBasedOnLong(IAddressable)
Returns whether part of the primary key is of type long.
Declaration
public static bool IsPrimaryKeyBasedOnLong(this IAddressable grain)
Parameters
Type | Name | Description |
---|---|---|
IAddressable | grain | The target grain. |
Returns
Type | Description |
---|---|
System.Boolean |