{"action":"created","issue":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2822","labels_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2822/labels{/name}","comments_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2822/comments","events_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2822/events","html_url":"https://github.com/Starcounter/Starcounter/issues/2822","id":97693341,"number":2822,"title":"Allow Db.Transact delegates to return values","user":{"login":"mtornwall","id":1321973,"avatar_url":"https://avatars.githubusercontent.com/u/1321973?v=3","gravatar_id":"","url":"https://api.github.com/users/mtornwall","html_url":"https://github.com/mtornwall","followers_url":"https://api.github.com/users/mtornwall/followers","following_url":"https://api.github.com/users/mtornwall/following{/other_user}","gists_url":"https://api.github.com/users/mtornwall/gists{/gist_id}","starred_url":"https://api.github.com/users/mtornwall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtornwall/subscriptions","organizations_url":"https://api.github.com/users/mtornwall/orgs","repos_url":"https://api.github.com/users/mtornwall/repos","events_url":"https://api.github.com/users/mtornwall/events{/privacy}","received_events_url":"https://api.github.com/users/mtornwall/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-28T12:28:43Z","updated_at":"2015-08-07T10:39:25Z","closed_at":null,"body":"I want to initiate a write transaction that returns a value that depends on the object written, such as its ID. Presently it seems that this cannot be done using `Db.Transact()`, so my workaround is this:\r\n\r\n    Db.Scope<string>(() => {\r\n        var foo = new Foo();\r\n        // ...\r\n        Transaction.Current.Commit(); // :-(\r\n        return foo.GetObjectID();\r\n    });\r\n\r\nIf `Db.Transact()` could propagate its delegate's return value I could avoid the ugly (and easily forgotten) call to `Transaction.Current.Commit()`.\r\n\r\n/sub @chrhol @Starcounter-Jack "},"comment":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/comments/128669683","html_url":"https://github.com/Starcounter/Starcounter/issues/2822#issuecomment-128669683","issue_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/2822","id":128669683,"user":{"login":"mtornwall","id":1321973,"avatar_url":"https://avatars.githubusercontent.com/u/1321973?v=3","gravatar_id":"","url":"https://api.github.com/users/mtornwall","html_url":"https://github.com/mtornwall","followers_url":"https://api.github.com/users/mtornwall/followers","following_url":"https://api.github.com/users/mtornwall/following{/other_user}","gists_url":"https://api.github.com/users/mtornwall/gists{/gist_id}","starred_url":"https://api.github.com/users/mtornwall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtornwall/subscriptions","organizations_url":"https://api.github.com/users/mtornwall/orgs","repos_url":"https://api.github.com/users/mtornwall/repos","events_url":"https://api.github.com/users/mtornwall/events{/privacy}","received_events_url":"https://api.github.com/users/mtornwall/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T10:39:25Z","updated_at":"2015-08-07T10:39:25Z","body":"> The only thing is a value returned in case of transaction not succeeded after max no of retries.\r\n\r\nAh, right! Perhaps it could return type `T?` so as to enable it to return value types as well?"}}