{"action":"created","issue":{"url":"https://api.github.com/repos/fluentmigrator/fluentmigrator/issues/735","repository_url":"https://api.github.com/repos/fluentmigrator/fluentmigrator","labels_url":"https://api.github.com/repos/fluentmigrator/fluentmigrator/issues/735/labels{/name}","comments_url":"https://api.github.com/repos/fluentmigrator/fluentmigrator/issues/735/comments","events_url":"https://api.github.com/repos/fluentmigrator/fluentmigrator/issues/735/events","html_url":"https://github.com/fluentmigrator/fluentmigrator/issues/735","id":180872038,"number":735,"title":"--output --outputFilename Not working for Execute.WithConnection","user":{"login":"TraGicCode","id":6224270,"avatar_url":"https://avatars0.githubusercontent.com/u/6224270?v=4","gravatar_id":"","url":"https://api.github.com/users/TraGicCode","html_url":"https://github.com/TraGicCode","followers_url":"https://api.github.com/users/TraGicCode/followers","following_url":"https://api.github.com/users/TraGicCode/following{/other_user}","gists_url":"https://api.github.com/users/TraGicCode/gists{/gist_id}","starred_url":"https://api.github.com/users/TraGicCode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TraGicCode/subscriptions","organizations_url":"https://api.github.com/users/TraGicCode/orgs","repos_url":"https://api.github.com/users/TraGicCode/repos","events_url":"https://api.github.com/users/TraGicCode/events{/privacy}","received_events_url":"https://api.github.com/users/TraGicCode/received_events","type":"User","site_admin":false},"labels":[{"id":191351117,"url":"https://api.github.com/repos/fluentmigrator/fluentmigrator/labels/will-not-fix","name":"will-not-fix","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-04T11:51:13Z","updated_at":"2018-03-31T22:41:23Z","closed_at":"2018-03-31T22:41:23Z","author_association":"NONE","body":"When executing a migration using the Execute.WithConnection() i am unable to get the generated sql that is to be performed within the callback to be output to a file.  Below is the output to a file i get\n\n```\n/* 2016100301: Migration_2016100301_NewMigrationUsingADO migrating =========== */\n\n/* Beginning Transaction */\n/* PerformDBOperation  */\n/* Performing DB Operation */\n\nINSERT INTO [dbo].[VersionInfo] ([Version], [AppliedOn], [Description]) VALUES (2016100301, '2016-10-04T11:46:49', 'Migration_2016100301_NewMigrationUsingADO')\nGO\n/* Committing Transaction */\n/* 2016100301: Migration_2016100301_NewMigrationUsingADO migrated */\n```\n\nAnd below is the code i'm using to generate my migration.  This is a simple unrelealistic example\n\n```\n    [Migration(2016100301)]\n    public class Migration_2016100301_NewMigrationUsingADO : ForwardOnlyMigration\n    {\n        public override void Up()\n        {\n            Execute.WithConnection((connection, transaction) =>\n            {\n                using (var cmd = transaction.Connection.CreateCommand())\n                {\n                    var sites = new List<WebSite>();\n                    cmd.Transaction = transaction;\n                    cmd.CommandType = CommandType.Text;\n                    cmd.CommandText = @\"SELECT [SiteId], \n                                                [Name] \n                                                FROM [dbo].[Sites]\";\n\n                    using (var reader = cmd.ExecuteReader())\n                    {\n                        while (reader.Read())\n                        {\n                            sites.Add(new WebSite\n                            {\n                                SiteId = reader.GetInt32(0),\n                                SiteName = reader.GetString(1)\n                            });\n                        }\n                    }\n                    cmd.CommandText = @\"UPDATE [dbo].[Sites] \n                                        SET [Name] = @RandomSiteName\n                                        WHERE [SiteId] = @SiteId\";\n\n                    foreach (var site in sites)\n                    {\n                            cmd.Parameters.Clear();\n                            cmd.Parameters.Add(new SqlParameter(\"SiteId\", site.SiteId));\n                            cmd.Parameters.Add(new SqlParameter(\"RandomSiteName\", site.SiteName + new Random().Next(0, sites.Count)));\n                            cmd.ExecuteNonQuery();\n                    }\n\n                }\n            });\n\n        }\n    }\n\n    public class WebSite\n    {\n        public int SiteId { get; set; }\n        public string SiteName { get; set; }\n    }\n```\n\nAnd finally below is the commandline i am passing to migrate.exe\n\n```\nmigrate.exe --timeout 600 --connectionString $ConnectionString --context $DatabaseName --assembly $MigrationsAssembly --provider sqlserver2008 --output --outputFilename \"$OutputSqlLocation\\DataMigrations.DB_01_Migrations.sql\"\n\n```\n"},"comment":{"url":"https://api.github.com/repos/fluentmigrator/fluentmigrator/issues/comments/377728568","html_url":"https://github.com/fluentmigrator/fluentmigrator/issues/735#issuecomment-377728568","issue_url":"https://api.github.com/repos/fluentmigrator/fluentmigrator/issues/735","id":377728568,"user":{"login":"fubar-coder","id":4739844,"avatar_url":"https://avatars3.githubusercontent.com/u/4739844?v=4","gravatar_id":"","url":"https://api.github.com/users/fubar-coder","html_url":"https://github.com/fubar-coder","followers_url":"https://api.github.com/users/fubar-coder/followers","following_url":"https://api.github.com/users/fubar-coder/following{/other_user}","gists_url":"https://api.github.com/users/fubar-coder/gists{/gist_id}","starred_url":"https://api.github.com/users/fubar-coder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fubar-coder/subscriptions","organizations_url":"https://api.github.com/users/fubar-coder/orgs","repos_url":"https://api.github.com/users/fubar-coder/repos","events_url":"https://api.github.com/users/fubar-coder/events{/privacy}","received_events_url":"https://api.github.com/users/fubar-coder/received_events","type":"User","site_admin":false},"created_at":"2018-03-31T22:41:23Z","updated_at":"2018-03-31T22:41:23Z","author_association":"OWNER","body":"That is by design, as FluentMigrator can only produce SQLs for the expressions you've provided."}}
{"actor":{"display_login":"fubar-coder"}}