示例#1
0
        public void Configure(IConfigSectionNode node)
        {
            EnsureObjectNotDisposed();
            m_Name = node.AttrByName(CONFIG_NAME_ATTR).ValueAsString(Guid.NewGuid().ToString());
            m_Node = new Node(node.AttrByName(CONFIG_NODE_ATTR).ValueAsString());

            if (m_Binding == null)
            {
                if (!string.IsNullOrWhiteSpace(m_Node.Binding))
                {
                    m_Binding = Glue.GetNodeBinding(m_Node);
                }
            }

            var bnode = node.AttrByName(CONFIG_BINDING_ATTR);

            if (bnode.Exists)
            {
                m_Binding = Glue.Bindings[bnode.Value];
            }


            var tNames = node.AttrByName(CONFIG_CONTRACT_SERVERS_ATTR).ValueAsString(CoreConsts.UNKNOWN).Split(';');

            var servers = new List <Type>();

            foreach (var t in tNames)
            {
                var tServer = Type.GetType(t, false);

                if (tServer == null)
                {
                    throw new GlueException(StringConsts.GLUE_SERVER_ENDPOINT_CONTRACT_SERVER_TYPE_ERROR + (t ?? CoreConsts.UNKNOWN));
                }

                servers.Add(tServer);
            }

            m_ContractServers = servers.ToArray();

            MsgInspectorConfigurator.ConfigureServerInspectors(m_MsgInspectors, node);
        }