GrainReference Class

Definition

This is the base class for all grain references.

[System.Serializable]
public class GrainReference : IEquatable<Orleans.Runtime.GrainReference>, Orleans.Runtime.IAddressable, System.Runtime.Serialization.ISerializable
[Orleans.Alias("GrainRef")]
[Orleans.DefaultInvokableBaseType(typeof(System.Threading.Tasks.ValueTask<>), typeof(Orleans.Runtime.Request<>))]
[Orleans.DefaultInvokableBaseType(typeof(System.Threading.Tasks.ValueTask), typeof(Orleans.Runtime.Request))]
[Orleans.DefaultInvokableBaseType(typeof(System.Threading.Tasks.Task<>), typeof(Orleans.Runtime.TaskRequest<>))]
[Orleans.DefaultInvokableBaseType(typeof(System.Threading.Tasks.Task), typeof(Orleans.Runtime.TaskRequest))]
[Orleans.DefaultInvokableBaseType(typeof(System.Void), typeof(Orleans.Runtime.VoidRequest))]
[Orleans.DefaultInvokableBaseType(typeof(System.Collections.Generic.IAsyncEnumerable<>), typeof(Orleans.Runtime.AsyncEnumerableRequest<>))]
public class GrainReference : IEquatable<Orleans.Runtime.GrainReference>, ISpanFormattable, Orleans.Runtime.IAddressable
[<System.Serializable>]
type GrainReference = class
    interface IAddressable
    interface IEquatable<GrainReference>
    interface ISerializable
[<Orleans.Alias("GrainRef")>]
[<Orleans.DefaultInvokableBaseType(typeof(System.Threading.Tasks.ValueTask<>), typeof(Orleans.Runtime.Request<>))>]
[<Orleans.DefaultInvokableBaseType(typeof(System.Threading.Tasks.ValueTask), typeof(Orleans.Runtime.Request))>]
[<Orleans.DefaultInvokableBaseType(typeof(System.Threading.Tasks.Task<>), typeof(Orleans.Runtime.TaskRequest<>))>]
[<Orleans.DefaultInvokableBaseType(typeof(System.Threading.Tasks.Task), typeof(Orleans.Runtime.TaskRequest))>]
[<Orleans.DefaultInvokableBaseType(typeof(System.Void), typeof(Orleans.Runtime.VoidRequest))>]
[<Orleans.DefaultInvokableBaseType(typeof(System.Collections.Generic.IAsyncEnumerable<>), typeof(Orleans.Runtime.AsyncEnumerableRequest<>))>]
type GrainReference = class
    interface IAddressable
    interface IEquatable<GrainReference>
    interface ISpanFormattable
    interface IFormattable
Public Class GrainReference
Implements IAddressable, IEquatable(Of GrainReference), ISerializable
Public Class GrainReference
Implements IAddressable, IEquatable(Of GrainReference), ISpanFormattable
Inheritance
GrainReference
Attributes
Implements

Constructors

GrainReference(GrainReference)

Constructs a copy of a grain reference.

GrainReference(GrainReference, InvokeMethodOptions)
GrainReference(GrainReferenceShared, IdSpan)

Initializes a new instance of the GrainReference class.

GrainReference(SerializationInfo, StreamingContext)

Fields

SystemTargetSilo

Called from generated code.

Properties

CodecProvider

Gets the serialization codec provider.

CopyContextPool

Gets the serialization copy context pool.

GrainId

Gets the grain id.

GrainIdentity
GrainServiceSiloAddress
InterfaceId

Implemented by generated subclasses to return a constant Implemented in generated code.

InterfaceName

Gets the interface name.

InterfaceType

Gets the interface type.

InterfaceVersion

Gets the interface version.

IsGrainService
IsInitializedSystemTarget

Whether the runtime environment for system targets has been initialized yet. Called from generated code.

Methods

Cast<TGrainInterface>()

Creates a new grain reference which implements the specified grain interface.

CopyGrainReference(Object, ICopyContext)

Copier function for grain reference.

DeserializeGrainReference(Type, IDeserializationContext)

Deserializer function for grain reference.

Equals(GrainReference)

Indicates whether the current object is equal to another object of the same type.

Equals(Object)

Tests this reference for equality to another object. Two grain references are equal if they both refer to the same grain.

GetHashCode()

Calculates a hash code for a grain reference.

GetInvokable<TInvokable>()
GetMethodName(Int32, Int32)

Return the method name associated with the specified interfaceId and methodId values.

GetObjectData(SerializationInfo, StreamingContext)
GetUniformHashCode()

Get a uniform hash code for this grain reference.

Invoke(IRequest)

Invokes the provided method.

InvokeAsync(IRequest)

Invokes the provided method.

InvokeAsync<T>(IRequest)

Invokes the provided method.

InvokeMethodAsync<T>(Int32, Object[], InvokeMethodOptions, SiloAddress)

Called from generated code.

InvokeOneWayMethod(Int32, Object[], InvokeMethodOptions, SiloAddress)

Called from generated code.

IsCompatible(Int32)

Implemented in generated code.

SerializeGrainReference(Object, ISerializationContext, Type)

Serializer function for grain reference.

ToKeyInfo()
ToKeyString()

Get the key value for this grain, as a string.

ToString()

Returns a string representation of this reference.

Operators

Equality(GrainReference, GrainReference)

Compares two references for equality. Two grain references are equal if they both refer to the same grain.

Inequality(GrainReference, GrainReference)

Compares two references for inequality. Two grain references are equal if they both refer to the same grain.

Explicit Interface Implementations

IFormattable.ToString(String, IFormatProvider)
ISpanFormattable.TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Extension Methods

AsReference(IAddressable, Type)

Returns a typed reference to the provided grain.

AsReference<TGrainInterface>(IAddressable)

Returns a typed reference to the provided grain.

BindGrainReference(IAddressable, IGrainFactory)

Binds the grain reference to the provided IGrainFactory.

Cast(IAddressable, Type)

Returns a typed reference to the provided grain.

Cast<TGrainInterface>(IAddressable)

Returns a typed reference to the provided grain.

GetGrainId(IAddressable)

Returns the grain id corresponding to the provided grain.

GetPrimaryKey(IAddressable)

Returns the Guid representation of a grain primary key.

GetPrimaryKey(IAddressable, String)

Returns the Guid representation of a grain primary key.

GetPrimaryKeyLong(IAddressable)

Returns the long representation of a grain primary key.

GetPrimaryKeyLong(IAddressable, String)

Returns the long representation of a grain primary key.

GetPrimaryKeyString(IAddressable)

Returns the string primary key of the grain.

IsPrimaryKeyBasedOnLong(IAddressable)

Returns whether part of the primary key is of type long.

ToShortKeyString(GrainReference)

Key string for grain references as unique as ToKeyString, but shorter and parseable. Intended for use where uniqueness and brevity are important.

Applies to