{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-dotnet/issues/514","repository_url":"https://api.github.com/repos/realm/realm-dotnet","labels_url":"https://api.github.com/repos/realm/realm-dotnet/issues/514/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-dotnet/issues/514/comments","events_url":"https://api.github.com/repos/realm/realm-dotnet/issues/514/events","html_url":"https://github.com/realm/realm-dotnet/issues/514","id":153104337,"number":514,"title":"Manage a Standalone RealmObject from a JSON response deserialized into a RealmObject","user":{"login":"CrimsonKyle","id":16037523,"avatar_url":"https://avatars.githubusercontent.com/u/16037523?v=3","gravatar_id":"","url":"https://api.github.com/users/CrimsonKyle","html_url":"https://github.com/CrimsonKyle","followers_url":"https://api.github.com/users/CrimsonKyle/followers","following_url":"https://api.github.com/users/CrimsonKyle/following{/other_user}","gists_url":"https://api.github.com/users/CrimsonKyle/gists{/gist_id}","starred_url":"https://api.github.com/users/CrimsonKyle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrimsonKyle/subscriptions","organizations_url":"https://api.github.com/users/CrimsonKyle/orgs","repos_url":"https://api.github.com/users/CrimsonKyle/repos","events_url":"https://api.github.com/users/CrimsonKyle/events{/privacy}","received_events_url":"https://api.github.com/users/CrimsonKyle/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-dotnet/labels/T:Help","name":"T:Help","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"fealebenpae","id":289915,"avatar_url":"https://avatars.githubusercontent.com/u/289915?v=3","gravatar_id":"","url":"https://api.github.com/users/fealebenpae","html_url":"https://github.com/fealebenpae","followers_url":"https://api.github.com/users/fealebenpae/followers","following_url":"https://api.github.com/users/fealebenpae/following{/other_user}","gists_url":"https://api.github.com/users/fealebenpae/gists{/gist_id}","starred_url":"https://api.github.com/users/fealebenpae/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fealebenpae/subscriptions","organizations_url":"https://api.github.com/users/fealebenpae/orgs","repos_url":"https://api.github.com/users/fealebenpae/repos","events_url":"https://api.github.com/users/fealebenpae/events{/privacy}","received_events_url":"https://api.github.com/users/fealebenpae/received_events","type":"User","site_admin":false},"assignees":[{"login":"fealebenpae","id":289915,"avatar_url":"https://avatars.githubusercontent.com/u/289915?v=3","gravatar_id":"","url":"https://api.github.com/users/fealebenpae","html_url":"https://github.com/fealebenpae","followers_url":"https://api.github.com/users/fealebenpae/followers","following_url":"https://api.github.com/users/fealebenpae/following{/other_user}","gists_url":"https://api.github.com/users/fealebenpae/gists{/gist_id}","starred_url":"https://api.github.com/users/fealebenpae/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fealebenpae/subscriptions","organizations_url":"https://api.github.com/users/fealebenpae/orgs","repos_url":"https://api.github.com/users/fealebenpae/repos","events_url":"https://api.github.com/users/fealebenpae/events{/privacy}","received_events_url":"https://api.github.com/users/fealebenpae/received_events","type":"User","site_admin":false}],"milestone":null,"comments":11,"created_at":"2016-05-04T20:15:18Z","updated_at":"2016-07-29T16:29:07Z","closed_at":"2016-05-06T12:48:50Z","body":"I need Realm to Manage a JSON result that is deserialized into a RealmObject.  What is the best way of doing this?\r\n\r\nError:  System.Reflection.TargetInvocationException: \"Exception has been thrown by the target of an invocation.\"\r\n\r\n```\r\npublic void FetchParent () \r\n{\r\n    // get the JSON object for the parent object \t\r\n    var client = new RestClient (); \t\r\n    client.BaseUrl = new Uri (\"https://baseurl.com”);  \t\r\n    var request = new RestRequest (\"service/12345”, Method.GET); \t\r\n    request.XmlSerializer.ContentType = \"applicaiton/json\";  \t\r\n    IRestResponse response = client.Execute (request); \t\r\n    var object = JsonConvert.DeserializeObject<Parent> (response.Content); \t\r\n\r\n\t// manage the standalone deserialized realm object\r\n\trealm.Write (() => { \r\n\t\trealm.Manage<Parent>(object); \t\r\n         } ); \r\n}\r\n```\r\n\r\n//************MODELS**************//\r\n\r\n```\r\npublic class Parent : RealmObject\r\n{\r\n\t[ObjectId]\r\n\tpublic string ParentId { get; set; }\r\n\tpublic DateTimeOffset ObjectDatestamp { get; set; }\r\n\r\n\tpublic string FirstName { get; set; }\r\n\tpublic string LastName { get; set; }\r\n\tpublic RealmList<Dogs> Dogs { get; }\r\n}\r\n\r\npublic class Dog : RealmObject\r\n{\r\n\t[ObjectId]\r\n\tpublic string DogId { get; set; }\r\n\tpublic DateTimeOffset ObjectDatestamp { get; set; }\r\n\r\n\tpublic string Type { get; set; }\r\n\tpublic string Name { get; set; }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/realm/realm-dotnet/issues/comments/236227695","html_url":"https://github.com/realm/realm-dotnet/issues/514#issuecomment-236227695","issue_url":"https://api.github.com/repos/realm/realm-dotnet/issues/514","id":236227695,"user":{"login":"kristiandupont","id":847742,"avatar_url":"https://avatars.githubusercontent.com/u/847742?v=3","gravatar_id":"","url":"https://api.github.com/users/kristiandupont","html_url":"https://github.com/kristiandupont","followers_url":"https://api.github.com/users/kristiandupont/followers","following_url":"https://api.github.com/users/kristiandupont/following{/other_user}","gists_url":"https://api.github.com/users/kristiandupont/gists{/gist_id}","starred_url":"https://api.github.com/users/kristiandupont/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristiandupont/subscriptions","organizations_url":"https://api.github.com/users/kristiandupont/orgs","repos_url":"https://api.github.com/users/kristiandupont/repos","events_url":"https://api.github.com/users/kristiandupont/events{/privacy}","received_events_url":"https://api.github.com/users/kristiandupont/received_events","type":"User","site_admin":false},"created_at":"2016-07-29T16:29:07Z","updated_at":"2016-07-29T16:29:07Z","body":"It's alright, no bother at all :-)\r\n\r\nThis error means that you are trying to read or write a property on an object that is no longer attached to a Realm. This could either be because it has been deleted from the Realm, or it could be because the Realm was closed. If none of those apply, it must be some other bug, potentially in our code so please let me know if this seems to be the case."}}
{"actor":{"display_login":"kristiandupont"}}