コード例 #1
0
        internal static GrainServiceConfigurations Load(XmlElement child)
        {
            var container = new GrainServiceConfigurations();

            var nsManager = new XmlNamespaceManager(new NameTable());

            nsManager.AddNamespace("orleans", "urn:orleans");

            GrainServiceConfiguration.LoadProviderConfigurations(
                child, nsManager, container.GrainServices,
                c => container.GrainServices.Add(c.Name, c));

            return(container);
        }
コード例 #2
0
        internal static void RegisterGrainService(GrainServiceConfigurations grainServicesConfig, string serviceName, string clientType, string serviceType, IDictionary <string, string> properties = null)
        {
            if (grainServicesConfig.GrainServices.ContainsKey(serviceName))
            {
                throw new InvalidOperationException(
                          string.Format("Grain service of with name '{0}' has been already registered", serviceName));
            }

            var config = new GrainServiceConfiguration(
                properties ?? new Dictionary <string, string>(),
                serviceName, clientType, serviceType);

            grainServicesConfig.GrainServices.Add(config.Name, config);
        }
コード例 #3
0
        internal static void LoadProviderConfigurations(XmlElement root, XmlNamespaceManager nsManager,
                                                        IDictionary <string, IGrainServiceConfiguration> alreadyLoaded, Action <IGrainServiceConfiguration> add)
        {
            var nodes = root.SelectNodes("orleans:GrainService", nsManager);

            foreach (var node in nodes)
            {
                var subElement = node as XmlElement;
                if (subElement == null)
                {
                    continue;
                }

                var config = new GrainServiceConfiguration();
                config.Load(subElement, alreadyLoaded, nsManager);
                add(config);
            }
        }