public void ClearProperty(string property) { PropertyProvider.CheckProperty(property); PropertyInfo pd = _GetProperty(property); if (pd != null) { _ResetProperty(pd); } }
public bool TrySetProperty(string property, object value) { PropertyProvider.CheckProperty(property); PropertyInfo pd = _GetProperty(property); if (pd != null && pd.GetValue(ObjectContext) != value) { pd.SetValue(ObjectContext, value); return(true); } return(false); }
public Type GetPropertyType(string property) { PropertyProvider.CheckProperty(property); object result; if (TryGetProperty(property, typeof(object), out result)) { return((result == null) ? _items.GetType().GetElementType() : result.GetType()); } return(null); }
public bool TryGetProperty(string property, Type propertyType, out object value) { PropertyProvider.CheckProperty(property); value = null; foreach (var pp in _items) { if (pp.TryGetProperty(property, propertyType, out value)) { return(true); } } return(false); }
public void SetProperty(string property, object value) { PropertyProvider.CheckProperty(property); PropertyInfo pd = _GetProperty(property); if (pd == null) { throw RuntimeFailure.PropertyNotFound(nameof(property), property); } if (pd.GetValue(ObjectContext) != value) { pd.SetValue(ObjectContext, value); } }
public bool TryGetProperty(string property, Type propertyType, out object value) { PropertyProvider.CheckProperty(property); value = null; int index; if (!int.TryParse(property, out index) || index < 0 || index >= _items.Length) { return(false); } value = _items[index]; return(value == null || propertyType.GetTypeInfo().IsInstanceOfType(value)); }
public Type GetPropertyType(string property) { PropertyProvider.CheckProperty(property); PropertyInfo descriptor = _GetProperty(property); if (descriptor == null) { return(null); } else { return(descriptor.PropertyType); } }
public bool TryGetProperty(string property, Type propertyType, out object value) { PropertyProvider.CheckProperty(property); value = null; if (!property.Contains(':')) { return(false); } string[] items = property.Split(new [] { ':' }, 2); string prefix = items[0]; string myProp = items[1]; var pp = _items.GetValueOrDefault(prefix) ?? PropertyProvider.Null; return(pp.TryGetProperty(myProp, propertyType, out value)); }
public bool TryGetProperty(string property, Type propertyType, out object value) { PropertyProvider.CheckProperty(property); value = null; try { value = _indexer.GetValue(_objectContext, new object[] { property }); } catch (TargetInvocationException ex) { if (ex.InnerException is KeyNotFoundException || ex.InnerException is ArgumentException) { return(false); } throw; } return(true); }
public bool TryGetProperty(string property, Type requiredType, out object value) { PropertyProvider.CheckProperty(property); PropertyInfo pd = _GetProperty(property); requiredType = requiredType ?? typeof(object); value = null; if (pd != null && TryGetValue(pd, out object tempValue)) { if (tempValue == null) { return(true); } return(TryCoerceValue(pd, tempValue, requiredType, out value) && requiredType.IsInstanceOfType(value)); } return(false); }
public bool TrySetProperty(string property, object value) { PropertyProvider.CheckProperty(property); return(false); }
Type IPropertyProvider.GetPropertyType(string property) { PropertyProvider.CheckProperty(property); return(null); }
void IProperties.SetProperty(string property, object value) { PropertyProvider.CheckProperty(property); }
void IProperties.ClearProperty(string property) { PropertyProvider.CheckProperty(property); }
public Type GetPropertyType(string property) { PropertyProvider.CheckProperty(property); return(_indexer.PropertyType); }