public double GetProperty(RealmPropertyFloat property) { var att = RealmConverter.PropertyDefinitionsFloat[property]; if (PropertiesFloat.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, RealmPropertyFloat property, out RealmPropertiesFloat entity) { entity = realm.RealmPropertiesFloat.FirstOrDefault(x => x.Type == (ushort)property); if (entity != null) { realm.RealmPropertiesFloat.Remove(entity); entity.Realm = null; return(true); } return(false); }
private static void SetProperty_Complex(Realm realm, RealmPropertyFloat property, RealmPropertyJsonModel pobj) { var result = realm.RealmPropertiesFloat.FirstOrDefault(x => x.Type == (ushort)property); if (result != null) { result.SetProperties(pobj); } else { var entity = new RealmPropertiesFloat { RealmId = realm.Id, Type = (ushort)property }; entity.SetProperties(pobj); realm.RealmPropertiesFloat.Add(entity); } }
public static void SetProperty(this Realm realm, RealmPropertyFloat property, double value) { var result = realm.RealmPropertiesFloat.FirstOrDefault(x => x.Type == (ushort)property); if (result != null) { result.Value = value; } else { var entity = new RealmPropertiesFloat { RealmId = realm.Id, Type = (ushort)property, Value = value, Realm = realm }; realm.RealmPropertiesFloat.Add(entity); } }
public static double?GetProperty(this Realm realm, RealmPropertyFloat property) { return(realm.RealmPropertiesFloat.FirstOrDefault(x => x.Type == (ushort)property)?.Value); }
public static string GetDescription(this RealmPropertyFloat prop) { var description = prop.GetAttributeOfType <DescriptionAttribute>(); return(description?.Description ?? prop.ToString()); }