public long GetProperty(RealmPropertyInt64 property) { var att = RealmConverter.PropertyDefinitionsInt64[property]; if (PropertiesInt64.TryGetValue(property, out var result)) { var val = result.Value; val = Math.Max(val, att.MinValue); val = Math.Min(val, att.MaxValue); return(val); } return(att.DefaultValue); }
public static bool TryRemoveProperty(this Realm realm, RealmPropertyInt64 property, out RealmPropertiesInt64 entity) { entity = realm.RealmPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property); if (entity != null) { realm.RealmPropertiesInt64.Remove(entity); entity.Realm = null; return(true); } return(false); }
private static void SetProperty_Complex(Realm realm, RealmPropertyInt64 property, RealmPropertyJsonModel pobj) { var result = realm.RealmPropertiesInt64.FirstOrDefault(x => x.Type == (ushort)property); if (result != null) { result.SetProperties(pobj); } else { var entity = new RealmPropertiesInt64 { RealmId = realm.Id, Type = (ushort)property }; entity.SetProperties(pobj); realm.RealmPropertiesInt64.Add(entity); } }
public static void SetProperty(this Realm realm, RealmPropertyInt64 property, long value) { var result = realm.RealmPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property); if (result != null) { result.Value = value; } else { var entity = new RealmPropertiesInt64 { RealmId = realm.Id, Type = (ushort)property, Value = value, Realm = realm }; realm.RealmPropertiesInt64.Add(entity); } }
public static string GetDescription(this RealmPropertyInt64 prop) { var description = prop.GetAttributeOfType <DescriptionAttribute>(); return(description?.Description ?? prop.ToString()); }
public static long?GetProperty(this Realm realm, RealmPropertyInt64 property) { return(realm.RealmPropertiesInt64.FirstOrDefault(x => x.Type == (uint)property)?.Value); }