src/Orleans.Core/Core/GrainFactory.cs
/// <summary>
/// Gets a grain reference which implements the specified grain interface type and has the specified grain key, without specifying the grain type directly.
/// </summary>
/// <remarks>
/// This method infers the most appropriate <see cref="GrainId.Type"/> value based on the <paramref name="interfaceType"/> argument and optional <paramref name="grainClassNamePrefix"/> argument.
/// The <see cref="GrainInterfaceTypeToGrainTypeResolver"/> type is responsible for determining the most appropriate grain type.
/// </remarks>
/// <param name="interfaceType">The interface type which the returned grain reference will implement.</param>
/// <param name="grainKey">The <see cref="GrainId.Key"/> portion of the grain id.</param>
/// <param name="grainClassNamePrefix">An optional grain class name prefix.</param>
/// <returns>A grain reference which implements the provided interface.</returns>
Gets a grain reference which implements the specified grain interface type and has the specified grain key, without specifying the grain type directly.
Gets a grain reference which implements the specified grain interface type and has the specified grain key without specifying the grain type directly .
private IAddressable GetGrain(Type interfaceType, IdSpan grainKey, string grainClassNamePrefix)
        {
            var grainInterfaceType = this.interfaceTypeResolver.GetGrainInterfaceType(interfaceType);
            GrainType grainType;
            if (!string.IsNullOrWhiteSpace(grainClassNamePrefix))
            {
                grainType = this.interfaceTypeToGrainTypeResolver.GetGrainType(grainInterfaceType, grainClassNamePrefix);
            }
            else
            {
                grainType = this.interfaceTypeToGrainTypeResolver.GetGrainType(grainInterfaceType);
            }
            var grainId = GrainId.Create(grainType, grainKey);
            var grain = this.referenceActivator.CreateReference(grainId, grainInterfaceType);
            return grain;
        }
private IAddressable GetGrain ( Type interfaceType , IdSpan grainKey , string grainClassNamePrefix ) { var grainInterfaceType = this . interfaceTypeResolver . GetGrainInterfaceType ( interfaceType ) ; GrainType grainType ; if ( ! string . IsNullOrWhiteSpace ( grainClassNamePrefix ) ) { grainType = this . interfaceTypeToGrainTypeResolver . GetGrainType ( grainInterfaceType , grainClassNamePrefix ) ; } else { grainType = this . interfaceTypeToGrainTypeResolver . GetGrainType ( grainInterfaceType ) ; } var grainId = GrainId . Create ( grainType , grainKey ) ; var grain = this . referenceActivator . CreateReference ( grainId , grainInterfaceType ) ; return grain ; }
Gets a grain reference which implements the specified grain interface type and has the specified grain key, without specifying the grain type directly.
Gets a grain reference which implements the specified grain interface type and has the specified grain key without specifying the grain type directly .
A grain reference which implements the provided interface.
A grain reference which implements the provided interface .
interfaceType
Type
The interface type which the returned grain reference will implement.
The interface type which the returned grain reference will implement .
grainKey
IdSpan
The  portion of the grain id.
The portion of the grain id .
grainClassNamePrefix
string
An optional grain class name prefix.
An optional grain class name prefix .
remarks
This method infers the most appropriate  value based on the  argument and optional  argument.
The  type is responsible for determining the most appropriate grain type.
This method infers the most appropriate value based on the argument and optional argument . The type is responsible for determining the most appropriate grain type .