{"action":"created","issue":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1423","repository_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate","labels_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1423/labels{/name}","comments_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1423/comments","events_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1423/events","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1423","id":180512763,"number":1423,"title":"Better Handle DbUpdateConcurrencyException","user":{"login":"easyfast","id":9320912,"avatar_url":"https://avatars.githubusercontent.com/u/9320912?v=3","gravatar_id":"","url":"https://api.github.com/users/easyfast","html_url":"https://github.com/easyfast","followers_url":"https://api.github.com/users/easyfast/followers","following_url":"https://api.github.com/users/easyfast/following{/other_user}","gists_url":"https://api.github.com/users/easyfast/gists{/gist_id}","starred_url":"https://api.github.com/users/easyfast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easyfast/subscriptions","organizations_url":"https://api.github.com/users/easyfast/orgs","repos_url":"https://api.github.com/users/easyfast/repos","events_url":"https://api.github.com/users/easyfast/events{/privacy}","received_events_url":"https://api.github.com/users/easyfast/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":null,"comments":3,"created_at":"2016-10-02T13:40:33Z","updated_at":"2016-10-03T05:26:24Z","closed_at":null,"body":"````C#\r\npublic ActionResult Update(UserTypeInput model)\r\n        {\r\n            if (ModelState.IsValid)\r\n            {\r\n                try\r\n                {\r\n                    long l = UserTypeService.Update(model);\r\n                    if (l > 0)\r\n                    {\r\n                        ViewBag.Result = true;\r\n                    }\r\n                    else\r\n                    {\r\n                        ModelState.AddModelError(\"\", \"人员类别名称重复！\");\r\n                    }\r\n                }\r\n                catch (DbUpdateConcurrencyException ex)\r\n                {\r\n                    ModelState.AddModelError(\"\", \"sorry，the data has been changed!\" + ex.Message);\r\n                }\r\n            }\r\n            return View(model);\r\n        }`\r\n````\r\n\r\nMy viewmodel has the TimeStamp property:\r\n\r\n````C#\r\n        [Timestamp]\r\n        public byte[] RowVersion { get; set; }\r\n````\r\n\r\nI find ABP(or mvc) can't catch the exception -DbUpdateConcurrencyException.\r\n\r\nHow ABP to dispose  optimistic concurrency\r\n"},"comment":{"url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/comments/251029141","html_url":"https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1423#issuecomment-251029141","issue_url":"https://api.github.com/repos/aspnetboilerplate/aspnetboilerplate/issues/1423","id":251029141,"user":{"login":"easyfast","id":9320912,"avatar_url":"https://avatars.githubusercontent.com/u/9320912?v=3","gravatar_id":"","url":"https://api.github.com/users/easyfast","html_url":"https://github.com/easyfast","followers_url":"https://api.github.com/users/easyfast/followers","following_url":"https://api.github.com/users/easyfast/following{/other_user}","gists_url":"https://api.github.com/users/easyfast/gists{/gist_id}","starred_url":"https://api.github.com/users/easyfast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/easyfast/subscriptions","organizations_url":"https://api.github.com/users/easyfast/orgs","repos_url":"https://api.github.com/users/easyfast/repos","events_url":"https://api.github.com/users/easyfast/events{/privacy}","received_events_url":"https://api.github.com/users/easyfast/received_events","type":"User","site_admin":false},"created_at":"2016-10-03T05:26:24Z","updated_at":"2016-10-03T05:26:24Z","body":"I thinki it's  dose't a good way. This code need used the EntityFrameWork package. Bug in  the layer of application, it must be a simple function. this function CheckDbUpdateConcurrency() should be EntityFrameWork layer. But if this. The code will be too wordy. Does have any better way?"}}
{"actor":{"display_login":"easyfast"}}