{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/635","repository_url":"https://api.github.com/repos/aspnet/DependencyInjection","labels_url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/635/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/635/comments","events_url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/635/events","html_url":"https://github.com/aspnet/DependencyInjection/pull/635","id":312710238,"number":635,"title":"Adding support for constrained open generics","user":{"login":"jbogard","id":104498,"avatar_url":"https://avatars1.githubusercontent.com/u/104498?v=4","gravatar_id":"","url":"https://api.github.com/users/jbogard","html_url":"https://github.com/jbogard","followers_url":"https://api.github.com/users/jbogard/followers","following_url":"https://api.github.com/users/jbogard/following{/other_user}","gists_url":"https://api.github.com/users/jbogard/gists{/gist_id}","starred_url":"https://api.github.com/users/jbogard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbogard/subscriptions","organizations_url":"https://api.github.com/users/jbogard/orgs","repos_url":"https://api.github.com/users/jbogard/repos","events_url":"https://api.github.com/users/jbogard/events{/privacy}","received_events_url":"https://api.github.com/users/jbogard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-04-09T22:27:26Z","updated_at":"2018-04-12T13:51:03Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/aspnet/DependencyInjection/pulls/635","html_url":"https://github.com/aspnet/DependencyInjection/pull/635","diff_url":"https://github.com/aspnet/DependencyInjection/pull/635.diff","patch_url":"https://github.com/aspnet/DependencyInjection/pull/635.patch"},"body":"(again)\r\n\r\nSee #471 for details. Figured I'd give this another shot.\r\n\r\nThe general scenario is:\r\n\r\nSuppose I have some interface, `IRepository<T>`. This interface allows me to save an entity to a database, perhaps wrapping EFCore `DbContext`. As part of saving, I want to validate so I have `IValidator<T>`.\r\n\r\nThe implementation `DbContextRepository<T>` uses an enumerable of  `IValidator<T>` to validate:\r\n\r\n```c#\r\nclass DbContextRepository<T> {\r\n    public DbContextRepository(\r\n        DbContext db, \r\n        IEnumerable<IValidator<T>> validators) {\r\n        // etc\r\n    }\r\n}\r\n```\r\n\r\nI want to be able to support:\r\n\r\n```c#\r\nclass IFooValidator<T> : IValidator<T> where T : IFoo { }\r\n```\r\n\r\ninstead of \r\n\r\n```c#\r\nclass IFooValidator : IValidator<IFoo> {}\r\n```\r\n\r\nFor the reasons in #471.\r\n\r\nIn case anything has changed, just wanted to throw this out there. I modified the approach to do what Autofac does, which is actually check the constraints if they exist (instead of the previous try-catch-swallow approach)."},"comment":{"url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/comments/380812165","html_url":"https://github.com/aspnet/DependencyInjection/pull/635#issuecomment-380812165","issue_url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/635","id":380812165,"user":{"login":"ENikS","id":1750155,"avatar_url":"https://avatars2.githubusercontent.com/u/1750155?v=4","gravatar_id":"","url":"https://api.github.com/users/ENikS","html_url":"https://github.com/ENikS","followers_url":"https://api.github.com/users/ENikS/followers","following_url":"https://api.github.com/users/ENikS/following{/other_user}","gists_url":"https://api.github.com/users/ENikS/gists{/gist_id}","starred_url":"https://api.github.com/users/ENikS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ENikS/subscriptions","organizations_url":"https://api.github.com/users/ENikS/orgs","repos_url":"https://api.github.com/users/ENikS/repos","events_url":"https://api.github.com/users/ENikS/events{/privacy}","received_events_url":"https://api.github.com/users/ENikS/received_events","type":"User","site_admin":false},"created_at":"2018-04-12T13:51:03Z","updated_at":"2018-04-12T13:51:03Z","author_association":"CONTRIBUTOR","body":"I see no point in doing checks. Try/Catch is 'cheaper' to execute. Occasional fail is better than extra delay on every resolve."}}
{"actor":{"display_login":"ENikS"}}