public string GetProperty(RealmPropertyString property)
 {
     if (PropertiesString.TryGetValue(property, out var result))
     {
         return(result.Value);
     }
     return(RealmConverter.PropertyDefinitionsString[property].DefaultValue);
 }
        public static bool TryRemoveProperty(this Realm realm, RealmPropertyString property, out RealmPropertiesString entity)
        {
            entity = realm.RealmPropertiesString.FirstOrDefault(x => x.Type == (uint)property);

            if (entity != null)
            {
                realm.RealmPropertiesString.Remove(entity);
                entity.Realm = null;
                return(true);
            }

            return(false);
        }
        private static void SetProperty_Complex(Realm realm, RealmPropertyString property, RealmPropertyJsonModel pobj)
        {
            var result = realm.RealmPropertiesString.FirstOrDefault(x => x.Type == (ushort)property);

            if (result != null)
            {
                result.SetProperties(pobj);
            }
            else
            {
                var entity = new RealmPropertiesString {
                    RealmId = realm.Id, Type = (ushort)property
                };
                entity.SetProperties(pobj);
                realm.RealmPropertiesString.Add(entity);
            }
        }
        public static void SetProperty(this Realm realm, RealmPropertyString property, string value)
        {
            var result = realm.RealmPropertiesString.FirstOrDefault(x => x.Type == (uint)property);

            if (result != null)
            {
                result.Value = value;
            }
            else
            {
                var entity = new RealmPropertiesString {
                    RealmId = realm.Id, Type = (ushort)property, Value = value, Realm = realm
                };

                realm.RealmPropertiesString.Add(entity);
            }
        }
Example #5
0
        public static string GetDescription(this RealmPropertyString prop)
        {
            var description = prop.GetAttributeOfType <DescriptionAttribute>();

            return(description?.Description ?? prop.ToString());
        }
 public static string GetProperty(this Realm realm, RealmPropertyString property)
 {
     return(realm.RealmPropertiesString.FirstOrDefault(x => x.Type == (uint)property)?.Value);
 }