Esempio n. 1
0
        private GrainInterfaceData GetOrAddGrainInterfaceData(Type iface, bool isGenericGrainClass)
        {
            var interfaceId = GrainInterfaceUtils.GetGrainInterfaceId(iface);
            var version     = GrainInterfaceUtils.GetGrainInterfaceVersion(iface);

            // If already exist
            GrainInterfaceData grainInterfaceData;

            if (table.TryGetValue(interfaceId, out grainInterfaceData))
            {
                return(grainInterfaceData);
            }

            // If not create new entry
            var interfaceName = TypeUtils.GetRawClassName(TypeUtils.GetFullName(iface));

            grainInterfaceData = new GrainInterfaceData(interfaceId, version, iface, interfaceName);
            table[interfaceId] = grainInterfaceData;

            // Add entry to mapping iface string -> data
            var interfaceTypeKey = GetTypeKey(iface, isGenericGrainClass);

            typeToInterfaceData[interfaceTypeKey] = grainInterfaceData;

            // If we are adding a concrete implementation of a generic interface
            // add also the latter to the map: GrainReference and InvokeMethodRequest
            // always use the id of the generic one
            if (iface.IsConstructedGenericType)
            {
                GetOrAddGrainInterfaceData(iface.GetGenericTypeDefinition(), true);
            }

            return(grainInterfaceData);
        }
Esempio n. 2
0
 public static ushort InterfaceVersion(this Type grainInterface) => GrainInterfaceUtils.GetGrainInterfaceVersion(grainInterface);