예제 #1
0
        public static void SetInput(this SqlParameterCollection parameters, string xml)
        {
            var input = XDocument.Parse(xml);

            foreach (var XInputValue in input.Root.Elements("parameter"))
            {
                DBTypeConverter.XElenemtToParam(
                    parameters["@" + XInputValue.Attribute("name").Value],
                    XInputValue);
            }
        }
예제 #2
0
        public static XElement GetOutput(this SqlParameterCollection parameters)
        {
            var output = new XElement("content");

            foreach (SqlParameter p in parameters)
            {
                if (
                    p.Direction == ParameterDirection.Input ||
                    p.Value == null || p.Value == DBNull.Value)
                {
                    continue;
                }

                var xp = new XElement("parameter");
                output.Add(xp);
                xp.Add(new XAttribute("name", p.ParameterName.Replace("@", "")));
                DBTypeConverter.ParamToXElenemt(p, xp);
            }
            return(output);
        }