{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6320","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6320/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6320/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6320/events","html_url":"https://github.com/aspnet/EntityFramework/issues/6320","id":171126368,"number":6320,"title":"Implement custom SqlServerConnection","user":{"login":"jhermsen","id":1192950,"avatar_url":"https://avatars.githubusercontent.com/u/1192950?v=3","gravatar_id":"","url":"https://api.github.com/users/jhermsen","html_url":"https://github.com/jhermsen","followers_url":"https://api.github.com/users/jhermsen/followers","following_url":"https://api.github.com/users/jhermsen/following{/other_user}","gists_url":"https://api.github.com/users/jhermsen/gists{/gist_id}","starred_url":"https://api.github.com/users/jhermsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhermsen/subscriptions","organizations_url":"https://api.github.com/users/jhermsen/orgs","repos_url":"https://api.github.com/users/jhermsen/repos","events_url":"https://api.github.com/users/jhermsen/events{/privacy}","received_events_url":"https://api.github.com/users/jhermsen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnet/EntityFramework/labels/type-investigation","name":"type-investigation","color":"0052cc"}],"state":"open","locked":false,"assignee":{"login":"ajcvickers","id":1430078,"avatar_url":"https://avatars.githubusercontent.com/u/1430078?v=3","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false},"assignees":[{"login":"ajcvickers","id":1430078,"avatar_url":"https://avatars.githubusercontent.com/u/1430078?v=3","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/19","html_url":"https://github.com/aspnet/EntityFramework/milestones/1.1.0","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/milestones/19/labels","id":1748298,"number":19,"title":"1.1.0","description":"","creator":{"login":"rowanmiller","id":4741851,"avatar_url":"https://avatars.githubusercontent.com/u/4741851?v=3","gravatar_id":"","url":"https://api.github.com/users/rowanmiller","html_url":"https://github.com/rowanmiller","followers_url":"https://api.github.com/users/rowanmiller/followers","following_url":"https://api.github.com/users/rowanmiller/following{/other_user}","gists_url":"https://api.github.com/users/rowanmiller/gists{/gist_id}","starred_url":"https://api.github.com/users/rowanmiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rowanmiller/subscriptions","organizations_url":"https://api.github.com/users/rowanmiller/orgs","repos_url":"https://api.github.com/users/rowanmiller/repos","events_url":"https://api.github.com/users/rowanmiller/events{/privacy}","received_events_url":"https://api.github.com/users/rowanmiller/received_events","type":"User","site_admin":false},"open_issues":111,"closed_issues":143,"state":"open","created_at":"2016-05-04T18:23:47Z","updated_at":"2016-08-22T16:40:20Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-08-15T08:11:25Z","updated_at":"2016-08-22T18:11:52Z","closed_at":null,"body":"I tried adding custom ISqlServerConnection service in the startup class like so:\r\n`// Add framework services.\r\n            services.AddScoped<ISqlServerConnection, SqlServerConnectionRLS>()\r\n                .AddEntityFramework()\r\n                .AddDbContext<AuthDbContext>(options =>\r\n                    options\r\n                    .UseSqlServer(Configuration.GetConnectionString(\"DefaultConnection\")));`\r\n\r\nThe problem is that entity framework isn't using my custom connection.\r\nI also did some copying and overriding other methods.\r\nI did get it working, but had to implement a custom UseSqlServer extension so I can override the SqlServerOptionsExtension and use a custom method to ApplyServices and add all required services without the default SqlServerConnection class.\r\n\r\nEF Core version: 1.0.0"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/241500231","html_url":"https://github.com/aspnet/EntityFramework/issues/6320#issuecomment-241500231","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/6320","id":241500231,"user":{"login":"ajcvickers","id":1430078,"avatar_url":"https://avatars.githubusercontent.com/u/1430078?v=3","gravatar_id":"","url":"https://api.github.com/users/ajcvickers","html_url":"https://github.com/ajcvickers","followers_url":"https://api.github.com/users/ajcvickers/followers","following_url":"https://api.github.com/users/ajcvickers/following{/other_user}","gists_url":"https://api.github.com/users/ajcvickers/gists{/gist_id}","starred_url":"https://api.github.com/users/ajcvickers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajcvickers/subscriptions","organizations_url":"https://api.github.com/users/ajcvickers/orgs","repos_url":"https://api.github.com/users/ajcvickers/repos","events_url":"https://api.github.com/users/ajcvickers/events{/privacy}","received_events_url":"https://api.github.com/users/ajcvickers/received_events","type":"User","site_admin":false},"created_at":"2016-08-22T18:11:52Z","updated_at":"2016-08-22T18:11:52Z","body":"@jhermsen If you use a shared service provider, then all services for EF and your application are registered in the same container. If you use separate service providers, then each provider will not resolve services from the other provider. This usually means that a custom service in the EF provider will not have access to application services."}}
{"actor":{"display_login":"ajcvickers"}}