Ejemplo n.º 1
0
        private DCRF.Contract.Connector.EndPoint GetEndPoint(IBlockWeb context)
        {
            DCRF.Contract.Connector.EndPoint result = new Connector.EndPoint(context);

            if (value != null)
            {
                result.Value = value;
            }
            else if (serviceName != null)
            {
                result.BlockId = blockId;
                result.ServiceName = serviceName;
            }
            else
            {
                result.BlockId = blockId;
                result.ConnectorKey = connectorKey;
            }

            foreach (EndPointDescriptor ep in this.FixedArgs)
            {
                result.AddFixedArg(ep.GetEndPoint(context));
            }

            return result;
        }
Ejemplo n.º 2
0
        private static Connector.EndPoint extractArgument(XmlElement argEndPoint, IBlockWeb containerWeb)
        {
            if (argEndPoint.GetAttribute("isMissing") == "true")
            {
                return null;
            }
            else if (argEndPoint.Name == "serviceEndPoint" || argEndPoint.Name == "serviceArg")
            {
                string endpointBlockId = argEndPoint.GetAttribute("blockId");
                string endpointService = argEndPoint.GetAttribute("service");

                Connector.EndPoint ep = new Connector.EndPoint(containerWeb);
                ep.BlockId = endpointBlockId;
                ep.ServiceName = endpointService;

                if (argEndPoint.HasAttribute("targetType"))
                {
                    ep.TargetType = Type.GetType(argEndPoint.GetAttribute("targetType"));
                }

                addFixedArgsToEndPoint(containerWeb, argEndPoint, ep);

                return ep;
            }
            else if (argEndPoint.Name == "connectorEndPoint" || argEndPoint.Name == "connectorArg")
            {
                string endpointBlockId = argEndPoint.GetAttribute("blockId");
                string endPointConnectorKey = argEndPoint.GetAttribute("connectorKey");

                Connector.EndPoint ep = new Connector.EndPoint(containerWeb);
                ep.BlockId = endpointBlockId;
                ep.ConnectorKey = endPointConnectorKey;

                if (argEndPoint.HasAttribute("targetType"))
                {
                    ep.TargetType = Type.GetType(argEndPoint.GetAttribute("targetType"));
                }

                addFixedArgsToEndPoint(containerWeb, argEndPoint, ep);

                return ep;
            }
            else if (argEndPoint.Name == "valueEndPoint" || argEndPoint.Name == "valueArg")
            {
                object value = ObjectReader.ReadObject(argEndPoint);
                Connector.EndPoint ep = new Connector.EndPoint(containerWeb);
                ep.Value = value;

                return ep;
            }

            throw new InvalidDataException();
        }