internal RealmValue(PrimitiveValue primitive, Realm realm = null, ObjectHandle handle = default, IntPtr propertyIndex = default) : this() { Type = primitive.Type; _objectHandle = handle; _propertyIndex = propertyIndex; switch (Type) { case RealmValueType.Data: _dataValue = primitive.AsBinary(); break; case RealmValueType.String: _stringValue = primitive.AsString(); break; case RealmValueType.Object: Argument.NotNull(realm, nameof(realm)); _objectValue = primitive.AsObject(realm); break; default: _primitiveValue = primitive; break; } }
protected RealmValue ToRealmValue(PrimitiveValue primitive, RealmObjectBase.Metadata metadata, Realm realm) { if (primitive.Type != RealmValueType.Object) { return(new RealmValue(primitive)); } var objectHandle = primitive.AsObject(Root); if (metadata == null) { throw new NotImplementedException("Mixed objects are not supported yet."); } return(new RealmValue(realm.MakeObject(metadata, objectHandle))); }