From 93464144f4fb9c19df37d0bc3858d019637a93be Mon Sep 17 00:00:00 2001 From: SushiHangover Date: Wed, 14 Dec 2016 13:25:25 -0800 Subject: [PATCH] Migrate CreateObject to Manage #1 --- src/RealmJson.Extensions/Extension.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/RealmJson.Extensions/Extension.cs b/src/RealmJson.Extensions/Extension.cs index e362f61..77ff615 100644 --- a/src/RealmJson.Extensions/Extension.cs +++ b/src/RealmJson.Extensions/Extension.cs @@ -190,8 +190,9 @@ static void CreateUpdateRecordsViaAutoMapper(Realm realm, PropertyInfo pkProp } if (realmObject == null) { - realmObject = realm.CreateObject(typeof(T).Name); + realmObject = (T)Activator.CreateInstance(typeof(T)); newMapper.Map(jsonObject, realmObject); + realm.Manage(realmObject, true); } else {