{"action":"created","issue":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/648","repository_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate","labels_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/648/labels{/name}","comments_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/648/comments","events_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/648/events","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/648","id":108702175,"number":648,"title":"IRepository.BulkInsert","user":{"login":"hikalkan","id":1210527,"avatar_url":"https://avatars.githubusercontent.com/u/1210527?v=3","gravatar_id":"","url":"https://api.github.com/users/hikalkan","html_url":"https://github.com/hikalkan","followers_url":"https://api.github.com/users/hikalkan/followers","following_url":"https://api.github.com/users/hikalkan/following{/other_user}","gists_url":"https://api.github.com/users/hikalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/hikalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hikalkan/subscriptions","organizations_url":"https://api.github.com/users/hikalkan/orgs","repos_url":"https://api.github.com/users/hikalkan/repos","events_url":"https://api.github.com/users/hikalkan/events{/privacy}","received_events_url":"https://api.github.com/users/hikalkan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/labels/feature%20request","name":"feature request","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/milestones/23","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/milestones/v1.0.0","labels_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/milestones/23/labels","id":1030650,"number":23,"title":"v1.0.0","description":"","creator":{"login":"hikalkan","id":1210527,"avatar_url":"https://avatars.githubusercontent.com/u/1210527?v=3","gravatar_id":"","url":"https://api.github.com/users/hikalkan","html_url":"https://github.com/hikalkan","followers_url":"https://api.github.com/users/hikalkan/followers","following_url":"https://api.github.com/users/hikalkan/following{/other_user}","gists_url":"https://api.github.com/users/hikalkan/gists{/gist_id}","starred_url":"https://api.github.com/users/hikalkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hikalkan/subscriptions","organizations_url":"https://api.github.com/users/hikalkan/orgs","repos_url":"https://api.github.com/users/hikalkan/repos","events_url":"https://api.github.com/users/hikalkan/events{/privacy}","received_events_url":"https://api.github.com/users/hikalkan/received_events","type":"User","site_admin":false},"open_issues":51,"closed_issues":0,"state":"open","created_at":"2015-03-20T09:14:23Z","updated_at":"2016-07-15T13:01:32Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-09-28T17:06:30Z","updated_at":"2016-07-19T10:25:47Z","closed_at":null,"body":"See forum request: http://forum.aspnetboilerplate.com/viewtopic.php?f=2&t=178"},"comment":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/comments/233591965","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/648#issuecomment-233591965","issue_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/648","id":233591965,"user":{"login":"krugerm","id":1419805,"avatar_url":"https://avatars.githubusercontent.com/u/1419805?v=3","gravatar_id":"","url":"https://api.github.com/users/krugerm","html_url":"https://github.com/krugerm","followers_url":"https://api.github.com/users/krugerm/followers","following_url":"https://api.github.com/users/krugerm/following{/other_user}","gists_url":"https://api.github.com/users/krugerm/gists{/gist_id}","starred_url":"https://api.github.com/users/krugerm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krugerm/subscriptions","organizations_url":"https://api.github.com/users/krugerm/orgs","repos_url":"https://api.github.com/users/krugerm/repos","events_url":"https://api.github.com/users/krugerm/events{/privacy}","received_events_url":"https://api.github.com/users/krugerm/received_events","type":"User","site_admin":false},"created_at":"2016-07-19T10:25:47Z","updated_at":"2016-07-19T10:25:47Z","body":"I agree with @wocar - EntityFramework.BulkInsert-ef seems to work well.\r\n\r\nI added BulkInsert() support for all `IRepositoryWithDbContext` repositories by adding a snippet to XXXRepositoryBase.cs\r\n\r\n```\r\npublic static class RepositoryExtensions\r\n{\r\n    // add BulkInsert to all EfRepositoryBase repositories\r\n    public static void BulkInsert<TEntity, TPrimaryKey>(this IRepositoryWithDbContext repository, ICollection<TEntity> entities)\r\n        where TEntity : class, IEntity<TPrimaryKey>\r\n    {\r\n        using (var t = new System.Transactions.TransactionScope())\r\n        {\r\n            var context = repository.GetDbContext();\r\n\r\n            context.BulkInsert(entities);\r\n            context.SaveChanges();\r\n\r\n            t.Complete();\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nAny problems with this approach?"}}
{"actor":{"display_login":"krugerm"}}