Exemplo n.º 1
0
        internal static int GetImplementationTypeCode(string grainImplementationClassName)
        {
            int typeCode;
            IGrainTypeResolver grainTypeResolver = RuntimeClient.Current.GrainTypeResolver;

            if (!grainTypeResolver.TryGetGrainTypeCode(grainImplementationClassName, out typeCode))
            {
                throw new ArgumentException(String.Format("Cannot find a type code for an implementation grain class: {0}. Make sure the grain assembly was correctly deployed and loaded in the silo.", grainImplementationClassName));
            }

            return(typeCode);
        }
Exemplo n.º 2
0
        internal static int GetImplementationTypeCode(Type interfaceType, string grainClassNamePrefix = null)
        {
            int typeCode;
            IGrainTypeResolver grainTypeResolver = RuntimeClient.Current.GrainTypeResolver;

            if (!grainTypeResolver.TryGetGrainTypeCode(interfaceType, out typeCode, grainClassNamePrefix))
            {
                var loadedAssemblies = grainTypeResolver.GetLoadedGrainAssemblies();
                throw new ArgumentException(
                          String.Format("Cannot find a type code for an implementation class for grain interface: {0}{2}. Make sure the grain assembly was correctly deployed and loaded in the silo.{1}",
                                        interfaceType,
                                        String.IsNullOrEmpty(loadedAssemblies) ? String.Empty : String.Format(" Loaded grain assemblies: {0}", loadedAssemblies),
                                        String.IsNullOrEmpty(grainClassNamePrefix) ? String.Empty : ", grainClassNamePrefix=" + grainClassNamePrefix));
            }
            return(typeCode);
        }