public MappedParameter(ParameterInfo parameterInfo, ParameterMapping map) {
     this.parameterInfo = parameterInfo;
     this.map = map;
 }
Пример #2
0
        private static ParameterMapping ReadParameterMapping(XmlReader reader) {
            System.Diagnostics.Debug.Assert(reader.NodeType == XmlNodeType.Element);
            if (!IsInNamespace(reader) || reader.LocalName != XmlMappingConstant.Parameter) {
                throw Error.UnexpectedElement(XmlMappingConstant.Parameter, String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}{1}{2}", reader.Prefix, String.IsNullOrEmpty(reader.Prefix) ? "" : "/", reader.LocalName));
            }

            ValidateAttributes(reader, new[] { 
                                               XmlMappingConstant.Name, 
                                               XmlMappingConstant.DbType, 
                                               XmlMappingConstant.Parameter, 
                                               XmlMappingConstant.Direction
                                           });

            ParameterMapping pm = new ParameterMapping();
            pm.Name = RequiredAttribute(reader, XmlMappingConstant.Name);
            pm.ParameterName = RequiredAttribute(reader, XmlMappingConstant.Parameter);
            pm.DbType = OptionalAttribute(reader, XmlMappingConstant.DbType);
            pm.XmlDirection = OptionalAttribute(reader, XmlMappingConstant.Direction);

            AssertEmptyElement(reader);

            return pm;
        }