System.Data.XmlSchemaDataImporter.ProcessDbCommand C# (CSharp) Method

ProcessDbCommand() private method

private ProcessDbCommand ( XmlElement el ) : DbCommand
el System.Xml.XmlElement
return DbCommand
		private DbCommand ProcessDbCommand (XmlElement el)
		{
			XmlElement e;
			//Console.WriteLine (el.LocalName);
			string cmdText = null;
			string cmdType = null;
			ArrayList parameters = null;
			
			if (el == null)
				return null;
			
			cmdType = el.GetAttribute ("CommandType");
			foreach (XmlNode n in el.ChildNodes) {
				e = n as XmlElement;
				if (e != null && e.LocalName == "CommandText")
					cmdText = e.InnerText;
				else if (e != null && e.LocalName == "Parameters" && !e.IsEmpty)
					parameters = ProcessDbParameters (e);
			}
			
			DbCommand cmd = currentAdapter.Provider.CreateCommand ();
			cmd.CommandText = cmdText;
			if (cmdType == "StoredProcedure")
				cmd.CommandType = CommandType.StoredProcedure;
			else
				cmd.CommandType = CommandType.Text;

			if (parameters != null)
				cmd.Parameters.AddRange (parameters.ToArray ());
			
			//Console.WriteLine ("Parameters count: {0}", cmd.Parameters.Count);
			return cmd;
		}