{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/10432","repository_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore","labels_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/10432/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/10432/comments","events_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/10432/events","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/10432","id":277809969,"number":10432,"title":"Stop adding connection string into code when scaffolding","user":{"login":"KallDrexx","id":139393,"avatar_url":"https://avatars2.githubusercontent.com/u/139393?v=4","gravatar_id":"","url":"https://api.github.com/users/KallDrexx","html_url":"https://github.com/KallDrexx","followers_url":"https://api.github.com/users/KallDrexx/followers","following_url":"https://api.github.com/users/KallDrexx/following{/other_user}","gists_url":"https://api.github.com/users/KallDrexx/gists{/gist_id}","starred_url":"https://api.github.com/users/KallDrexx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KallDrexx/subscriptions","organizations_url":"https://api.github.com/users/KallDrexx/orgs","repos_url":"https://api.github.com/users/KallDrexx/repos","events_url":"https://api.github.com/users/KallDrexx/events{/privacy}","received_events_url":"https://api.github.com/users/KallDrexx/received_events","type":"User","site_admin":false},"labels":[{"id":403964287,"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/labels/closed-by-design","name":"closed-by-design","color":"777777","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-11-29T16:03:07Z","updated_at":"2017-11-30T16:05:58Z","closed_at":"2017-11-29T22:07:00Z","author_association":"NONE","body":"When I run the command:\r\n\r\n`dotnet ef dbcontext scaffold \"<connection-string>\" Microsoft.EntityFrameworkCore.SqlServer -o \"Data\" -c \"ApiDbContext\" -f`\r\n\r\nIt generates a `ApiDbContext.cs` file with the following:\r\n\r\n```\r\n       protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)\r\n        {\r\n            #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.\r\n            optionsBuilder.UseSqlServer(@\"<connection string>\");\r\n        }\r\n```\r\n\r\nThis is unacceptable, as I have literally just spent 2 hours trying to figure out why my our staging environments were hitting our development databases instead of our production databases.  We run this command every time we have any database  schema changes (because we do database first instead of code first) and this time I forgot to remove this.  \r\n\r\nIt got lost in a code review because of other changes in that file as well as lots of changes in other areas of the code.\r\n\r\nIt got lost in the warnings message because the current build has a lot of warnings because of `[Obsolete]` tags that we cannot remedy immediately.\r\n\r\nTo me this whole situation is unacceptable, if for no other reason then you are encouraging users to put their sensitive connection strings in source control while at the same time saying \"this is a bad practice but we will still shove this in your code every time you run this command\".  All it takes is one person to miss that message and it's in source control forever (or can be a royal pain to remove if it's an active code base).  \r\n\r\nWhile running `dotnet ef dcontext scaffold --help` I do not see any option to help remedy this either.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/comments/348234501","html_url":"https://github.com/aspnet/EntityFrameworkCore/issues/10432#issuecomment-348234501","issue_url":"https://api.github.com/repos/aspnet/EntityFrameworkCore/issues/10432","id":348234501,"user":{"login":"josh-sachs","id":11616365,"avatar_url":"https://avatars0.githubusercontent.com/u/11616365?v=4","gravatar_id":"","url":"https://api.github.com/users/josh-sachs","html_url":"https://github.com/josh-sachs","followers_url":"https://api.github.com/users/josh-sachs/followers","following_url":"https://api.github.com/users/josh-sachs/following{/other_user}","gists_url":"https://api.github.com/users/josh-sachs/gists{/gist_id}","starred_url":"https://api.github.com/users/josh-sachs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josh-sachs/subscriptions","organizations_url":"https://api.github.com/users/josh-sachs/orgs","repos_url":"https://api.github.com/users/josh-sachs/repos","events_url":"https://api.github.com/users/josh-sachs/events{/privacy}","received_events_url":"https://api.github.com/users/josh-sachs/received_events","type":"User","site_admin":false},"created_at":"2017-11-30T16:05:58Z","updated_at":"2017-11-30T16:05:58Z","author_association":"NONE","body":"It's fine - I might just be having a bad day and took it the wrong way, but reading it still seems condescending.  Perhaps sarcastic was the wrong word. I recognize that I have a tendency to get combative, so apologies for that.  \r\n\r\nRegardless there is, and apparently may continue to be an issue here for teams not using code-first to drive the database schema.  My original text attempts to highlight the issue that appears to just be, at this point, symptomatic of the direction the framework appears to be moving in. \r\n\r\nThe PR submitted by Kalldrex proposes to alleviate it, so at this point there isn't much more to discuss.  It is either determined to be a worthwhile inclusion or it isn't.  I don't quite see how intentionally keeping the tooling ham stringed for this particular scenario benefits anyone, but that is just me and my opinion. \r\n\r\n\r\n"}}
{"actor":{"display_login":"josh-sachs"}}