Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new <see cref="SystemTargetGrainId"/> instance.
        /// </summary>
        public static SystemTargetGrainId Create(GrainType kind, SiloAddress address, string extraIdentifier)
        {
            if (extraIdentifier is string)
            {
                return(new SystemTargetGrainId(GrainId.Create(kind, address.ToParsableString() + SegmentSeparator + extraIdentifier)));
            }

            return(Create(kind, address));
        }
Ejemplo n.º 2
0
 /// <summary> Get the key value for this grain, as a string. </summary>
 public string ToKeyString()
 {
     if (IsObserverReference)
     {
         return(String.Format("{0}={1} {2}={3}", GRAIN_REFERENCE_STR, GrainId.ToParsableString(), OBSERVER_ID_STR, observerId.ToParsableString()));
     }
     if (IsSystemTarget)
     {
         return(String.Format("{0}={1} {2}={3}", GRAIN_REFERENCE_STR, GrainId.ToParsableString(), SYSTEM_TARGET_STR, SystemTargetSilo.ToParsableString()));
     }
     if (HasGenericArgument)
     {
         return(String.Format("{0}={1} {2}={3}", GRAIN_REFERENCE_STR, GrainId.ToParsableString(), GENERIC_ARGUMENTS_STR, genericArguments));
     }
     return(String.Format("{0}={1}", GRAIN_REFERENCE_STR, GrainId.ToParsableString()));
 }
Ejemplo n.º 3
0
 public static GrainId GetSystemTargetGrainId(GrainType kind, SiloAddress address)
 {
     return(GrainId.Create(kind, address.ToParsableString()));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a <see cref="GrainId"/> for a grain service.
        /// </summary>
        public static GrainId CreateGrainServiceGrainId(int typeCode, string grainSystemId, SiloAddress address)
        {
            var grainType = GrainType.Create($"{GrainTypePrefix.GrainServicePrefix}{typeCode:X8}{grainSystemId}");

            return(GrainId.Create(grainType, address.ToParsableString()));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a new <see cref="SystemTargetGrainId"/> instance.
 /// </summary>
 public static SystemTargetGrainId Create(GrainType kind, SiloAddress address) => new SystemTargetGrainId(GrainId.Create(kind, address.ToParsableString()));