{"action":"created","issue":{"url":"https://api.github.com/repos/tiagoln/BulkExtensions/issues/21","repository_url":"https://api.github.com/repos/tiagoln/BulkExtensions","labels_url":"https://api.github.com/repos/tiagoln/BulkExtensions/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/tiagoln/BulkExtensions/issues/21/comments","events_url":"https://api.github.com/repos/tiagoln/BulkExtensions/issues/21/events","html_url":"https://github.com/tiagoln/BulkExtensions/issues/21","id":235378909,"number":21,"title":"A question: Repository pattern and Bulk Insert","user":{"login":"afshany","id":17051920,"avatar_url":"https://avatars2.githubusercontent.com/u/17051920?v=3","gravatar_id":"","url":"https://api.github.com/users/afshany","html_url":"https://github.com/afshany","followers_url":"https://api.github.com/users/afshany/followers","following_url":"https://api.github.com/users/afshany/following{/other_user}","gists_url":"https://api.github.com/users/afshany/gists{/gist_id}","starred_url":"https://api.github.com/users/afshany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afshany/subscriptions","organizations_url":"https://api.github.com/users/afshany/orgs","repos_url":"https://api.github.com/users/afshany/repos","events_url":"https://api.github.com/users/afshany/events{/privacy}","received_events_url":"https://api.github.com/users/afshany/received_events","type":"User","site_admin":false},"labels":[{"id":474739386,"url":"https://api.github.com/repos/tiagoln/BulkExtensions/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-06-12T22:02:31Z","updated_at":"2017-06-13T19:06:47Z","closed_at":null,"body":"I am not sure if I can use bulk insert in repository pattern?\r\n\r\nthanks,\r\n-Shany"},"comment":{"url":"https://api.github.com/repos/tiagoln/BulkExtensions/issues/comments/308217232","html_url":"https://github.com/tiagoln/BulkExtensions/issues/21#issuecomment-308217232","issue_url":"https://api.github.com/repos/tiagoln/BulkExtensions/issues/21","id":308217232,"user":{"login":"tiagoln","id":5368835,"avatar_url":"https://avatars3.githubusercontent.com/u/5368835?v=3","gravatar_id":"","url":"https://api.github.com/users/tiagoln","html_url":"https://github.com/tiagoln","followers_url":"https://api.github.com/users/tiagoln/followers","following_url":"https://api.github.com/users/tiagoln/following{/other_user}","gists_url":"https://api.github.com/users/tiagoln/gists{/gist_id}","starred_url":"https://api.github.com/users/tiagoln/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiagoln/subscriptions","organizations_url":"https://api.github.com/users/tiagoln/orgs","repos_url":"https://api.github.com/users/tiagoln/repos","events_url":"https://api.github.com/users/tiagoln/events{/privacy}","received_events_url":"https://api.github.com/users/tiagoln/received_events","type":"User","site_admin":false},"created_at":"2017-06-13T19:06:47Z","updated_at":"2017-06-13T19:06:47Z","body":"> I don't see the point of Transaction when you commit changes to DB in BulkInsert!\r\n\r\nActually that's not true, If you begin your own transaction by calling `context.BeginTransaction()` anywhere in your code, the library will use your transaction and will NOT commit at the end, the line of code in the BulkOperation class that calls `context.Commit()` checks if you are managing your own transactions, the `context` object in this line is not `DbContext`, it is in fact an object of type [`DbContexWrapper`,](https://github.com/tiagoln/BulkExtensions/blob/master/BulkExtensions.Shared/Context/DbContextWrapper.cs) an abstraction I use to deal with connections and transactions related stuff.\r\n\r\nThe `Commit()` method body of the `DbContexWrapper` class only Commits the transaction if it is an internal one, not created by you, it is done this way because if you do not create you own transactions I need to create internal ones for the scope of the operation to prevent inconsistent data to be persisted in case of any error:\r\n\r\n`Commit()` method body:\r\n```\r\npublic void Commit()\r\n        {\r\n            if (IsInternalTransaction)\r\n            {\r\n                Transaction.Commit();\r\n                Transaction.Dispose();\r\n            }\r\n        }\r\n```"}}
{"actor":{"display_login":"tiagoln"}}