public static Message Composite(XmlReader xmlReader, DbConnection connection, Type commandBuilderType, string action)
        {
            string ns = AdoNetAdapter.MESSAGENAMESPACE;
            dynamic staticCommandBuilder = new StaticMembersDynamicWrapper(commandBuilderType);

            var stream = new System.IO.MemoryStream();

            using (var writer = XmlWriter.Create(stream))
            {
                writer.WriteStartElement("CompositeResult", ns);

                xmlReader.MoveToContent();
                xmlReader.Read();

                while (xmlReader.Read())
                {
                    string operationType = xmlReader.LocalName;

                }

                writer.WriteEndDocument();
                writer.Flush();
                stream.Seek(0, System.IO.SeekOrigin.Begin);

                return Message.CreateMessage(MessageVersion.Default, action, XmlReader.Create(stream));
            }
        }
        public static Message MultiExecute(XmlReader xmlReader, DbConnection connection, string procedureName, Type commandBuilderType, string action)
        {
            string ns = AdoNetAdapter.MESSAGENAMESPACE;
            dynamic staticCommandBuilder = new StaticMembersDynamicWrapper(commandBuilderType);

            var stream = new System.IO.MemoryStream();

            using (var writer = XmlWriter.Create(stream))
            {
                writer.WriteStartElement("MultiExecuteResult", ns);

                xmlReader.MoveToContent();
                xmlReader.Read();

                while (xmlReader.Read())
                {
                    var command = connection.CreateCommand();

                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.CommandText = procedureName;

                    staticCommandBuilder.DeriveParameters(command);

                    DbHelpers.SetParameters(xmlReader.ReadSubtree(), command.Parameters);

                    // TODO: parametri in uscita

                    using (var reader = command.ExecuteReader())
                    {
                        WriteResult(writer, reader);
                    }
                }

                writer.WriteEndDocument();
                writer.Flush();
                stream.Seek(0, System.IO.SeekOrigin.Begin);

                return Message.CreateMessage(MessageVersion.Default, action, XmlReader.Create(stream));
            }
        }
        public static Message Execute(XmlReader xmlReader, DbConnection connection, string procedureName, Type commandBuilderType, string action)
        {
            var command = connection.CreateCommand();

            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.CommandText = procedureName;

            dynamic staticCommandBuilder = new StaticMembersDynamicWrapper(commandBuilderType);
            staticCommandBuilder.DeriveParameters(command);

            DbHelpers.SetParameters(xmlReader.ReadSubtree(), command.Parameters);

            // TODO: parametri in uscita

            using (var reader = command.ExecuteReader())
            {
                return DbHelpers.CreateMessage(reader, action);
            }
        }