public PropertyValueDeserializerNode(IDeserializerNode parent, PropertySpec property) { Parent = parent; Property = property; ValueType = property.PropertyType; Context = parent.Context; }
public PropertyValueDeserializerNode(IDeserializerNode parent, PropertySpec property) { this.parent = parent; this.property = property; this.valueType = property.PropertyType; this.context = parent.Context; }
public PropertyValueSerializerNode( ISerializerNode parentNode, PropertySpec property) { if (parentNode == null) throw new ArgumentNullException("parentNode"); if (property == null) throw new ArgumentNullException("propertyMapping"); this.parentNode = parentNode; this.property = property; context = parentNode.Context; }
private static string GetExpandPath(ISerializerNode parentNode, PropertySpec property) { if (string.IsNullOrEmpty(parentNode.ExpandPath)) { if (property is QueryResultType.ItemsPropertySpec) return string.Empty; return property.LowerCaseName; } return string.Concat(parentNode.ExpandPath, ".", property.LowerCaseName); }
public PropertyValueSerializerNode( ISerializerNode parentNode, PropertySpec property) : base( property != null ? property.PropertyType : null, GetExpandPath(parentNode, property), parentNode != null ? parentNode.Context : null, parentNode) { if (parentNode == null) throw new ArgumentNullException(nameof(parentNode)); if (property == null) throw new ArgumentNullException(nameof(property)); Property = property; }
private void BuildRelativeUri(object entity, PropertySpec property, StringBuilder sb) { var entityType = entity.GetType(); var type = this.typeMapper.FromType(entityType) as ResourceType; if (type == null) throw new InvalidOperationException($"Can't get URI for {entityType}; can only get Uri for a ResourceType."); type.AppendUri(entity, sb); if (property != null) { if (sb.Length > 0) sb.Append('/'); sb.Append(((ResourceProperty)property).UriName); } }
public string GetUriFor(PropertySpec property, object entity) { return RelativeToAbsoluteUri(BuildRelativeUri(entity, property)); }
private string BuildRelativeUri(object entity, PropertySpec property) { var sb = new StringBuilder(); BuildRelativeUri(entity, property, sb); return sb.ToString(); }
private bool TryGetPropertyByName(string propertyName, out PropertySpec prop) { return Type.TryGetPropertyByName(propertyName, StringComparison.InvariantCulture, out prop); }
public override PropertySetter LoadSetter(PropertySpec propertySpec) { return Filter.GetPropertySetter(propertySpec.ReflectedType, propertySpec.PropertyInfo) ?? base.LoadSetter(propertySpec); }
public override TypeSpec LoadPropertyType(PropertySpec propertySpec) { var complexProperty = propertySpec as StructuredProperty; if (complexProperty != null) return FromType(Filter.GetPropertyType(complexProperty.ReflectedType, complexProperty.PropertyInfo)); return base.LoadPropertyType(propertySpec); }
public override PropertyFlags LoadPropertyFlags(PropertySpec propertySpec) { return Filter.GetPropertyFlags(propertySpec.PropertyInfo) ?? base.LoadPropertyFlags(propertySpec); }
private void BuildRelativeUri(object entity, PropertySpec property, StringBuilder sb) { var type = this.typeMapper.GetClassMapping(entity.GetType()) as ResourceType; if (type == null) throw new InvalidOperationException("Can only get Uri for a ResourceType."); type.AppendUri(entity, sb); if (property != null) { sb.Append('/'); sb.Append(((PropertyMapping)property).UriName); } }
public virtual PropertyFlags LoadPropertyFlags(PropertySpec propertySpec) { if (propertySpec == null) throw new ArgumentNullException("propertySpec"); return propertySpec.OnLoadPropertyFlags(); }
public string GetUri(PropertySpec property, object value) { return "http://todo"; }
public virtual PropertySetter LoadSetter(PropertySpec propertySpec) { if (propertySpec == null) throw new ArgumentNullException(nameof(propertySpec)); return propertySpec.OnLoadSetter(); }
public virtual TypeSpec LoadPropertyType(PropertySpec propertySpec) { if (propertySpec == null) throw new ArgumentNullException(nameof(propertySpec)); return propertySpec.OnLoadPropertyType(); }
public virtual PropertySpec LoadBaseDefinition(PropertySpec propertySpec) { if (propertySpec == null) throw new ArgumentNullException(nameof(propertySpec)); return propertySpec.OnLoadBaseDefinition(); }
public Action<object, object> LoadSetter(PropertySpec propertySpec) { if (propertySpec == null) throw new ArgumentNullException("propertySpec"); return propertySpec.OnLoadSetter(); }
public virtual TypeSpec LoadReflectedType(PropertySpec propertySpec) { if (propertySpec == null) throw new ArgumentNullException("propertySpec"); return propertySpec.OnLoadReflectedType(); }
public bool PropertyIsSerialized(PropertySpec property) { return property.IsSerialized; }
public override TypeSpec LoadDeclaringType(PropertySpec propertySpec) { if (propertySpec is StructuredProperty) return FromType(GetKnownDeclaringType(propertySpec.ReflectedType, propertySpec.PropertyInfo)); return base.LoadDeclaringType(propertySpec); }
public void SetProperty(PropertySpec property, object propertyValue) { Context.SetProperty(this, property, propertyValue); }
public bool TryGetPropertyByName(string propertyName, bool ignoreCase, out PropertySpec propertySpec) { var stringComparison = ignoreCase ? StringComparison.InvariantCultureIgnoreCase : StringComparison.InvariantCulture; // TODO: Possible to optimize here by putting property names in a dictionary propertySpec = Properties.FirstOrDefault(x => string.Equals(x.Name, propertyName, stringComparison)); return propertySpec != null; }