コード例 #1
0
        public static void ReplaceRealm(Realm realm, AuditUpdate auditData)
        {
            ReplaceRealmObjects(realm, new[] { auditData.AuditVersion }, x => x.CommitHash);
            ReplaceRealmObjects(realm, auditData.Communities, x => x.Id);
            ReplaceRealmObjects(realm, auditData.Friends, x => x.Id);
            ReplaceRealmObjects(realm, auditData.Meetups, x => x.Id);

            ReplaceRealmObjects(realm, auditData.Meetups.SelectMany(m => m.Sessions), x => x.Id);

            ReplaceRealmObjects(realm, auditData.Speakers, x => x.Id);
            ReplaceRealmObjects(realm, auditData.Talks, x => x.Id);
            ReplaceRealmObjects(realm, auditData.Venues, x => x.Id);
        }
コード例 #2
0
        // TODO support deletion
        public static void UpdateRealm(Realm realm, AuditUpdate auditData)
        {
            ReplaceRealmObjects(realm, new[] { auditData.AuditVersion }, x => x.CommitHash);

            using (var transaction = realm.BeginWrite())
            {
                UpdateRealmObjects(realm, auditData.Communities);
                UpdateRealmObjects(realm, auditData.Friends);
                UpdateRealmObjects(realm, auditData.Meetups);

                UpdateRealmObjects(realm, auditData.Meetups.SelectMany(m => m.Sessions));

                UpdateRealmObjects(realm, auditData.Speakers);
                UpdateRealmObjects(realm, auditData.Talks);
                UpdateRealmObjects(realm, auditData.Venues);

                transaction.Commit();
            }
        }