private static ImmutableDictionary <GrainInterfaceId, GrainInterfaceProperties> CreateInterfaceManifest( IEnumerable <IGrainInterfacePropertiesProvider> propertyProviders, IApplicationPartManager applicationPartManager, GrainInterfaceIdResolver grainInterfaceIdProvider) { var feature = applicationPartManager.CreateAndPopulateFeature <GrainInterfaceFeature>(); var builder = ImmutableDictionary.CreateBuilder <GrainInterfaceId, GrainInterfaceProperties>(); foreach (var value in feature.Interfaces) { var interfaceId = grainInterfaceIdProvider.GetGrainInterfaceId(value.InterfaceType); var properties = new Dictionary <string, string>(); foreach (var provider in propertyProviders) { provider.Populate(value.InterfaceType, interfaceId, properties); } var result = new GrainInterfaceProperties(properties.ToImmutableDictionary()); if (builder.ContainsKey(interfaceId)) { throw new InvalidOperationException($"An entry with the key {interfaceId} is already present." + $"\nExisting: {builder[interfaceId].ToDetailedString()}\nTrying to add: {result.ToDetailedString()}" + "\nConsider using the [GrainInterfaceId(\"name\")] attribute to give these interfaces unique names."); } builder.Add(interfaceId, result); } return(builder.ToImmutable()); }
public SiloManifestProvider( IEnumerable <IGrainPropertiesProvider> grainPropertiesProviders, IEnumerable <IGrainInterfacePropertiesProvider> grainInterfacePropertiesProviders, IApplicationPartManager applicationPartManager, GrainTypeResolver typeProvider, GrainInterfaceIdResolver interfaceIdProvider) { var grains = CreateGrainManifest(grainPropertiesProviders, applicationPartManager, typeProvider); var interfaces = CreateInterfaceManifest(grainInterfacePropertiesProviders, applicationPartManager, interfaceIdProvider); this.SiloManifest = new SiloManifest(grains, interfaces); }
public ImplementedInterfaceProvider(GrainInterfaceIdResolver interfaceIdProvider) { this.interfaceIdProvider = interfaceIdProvider; }