public static void InsertNotifications(DbConnection connection, string notificationsXml) { var dbType = DatabaseTypeHelper.ResolveDatabaseType(connection); var query = dbType == DatabaseType.Postgres ? PgInsertNotificationsQuery : SqlInsertNotificationsQuery; using (var cmd = DbCommandFactory.Create(query, connection)) { cmd.CommandType = CommandType.Text; cmd.Parameters.Add(SqlQuerySyntaxHelper.GetXmlParameter("@notifications", notificationsXml, dbType)); cmd.ExecuteNonQuery(); } }