상속: MemberSpec
 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;
 }
예제 #4
0
        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);
        }
예제 #5
0
 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;
 }
예제 #6
0
        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);
            }
        }
예제 #7
0
 public string GetUriFor(PropertySpec property, object entity)
 {
     return RelativeToAbsoluteUri(BuildRelativeUri(entity, property));
 }
예제 #8
0
 private string BuildRelativeUri(object entity, PropertySpec property)
 {
     var sb = new StringBuilder();
     BuildRelativeUri(entity, property, sb);
     return sb.ToString();
 }
예제 #9
0
 private bool TryGetPropertyByName(string propertyName, out PropertySpec prop)
 {
     return Type.TryGetPropertyByName(propertyName, StringComparison.InvariantCulture, out prop);
 }
예제 #10
0
파일: TypeMapper.cs 프로젝트: Pomona/Pomona
 public override PropertySetter LoadSetter(PropertySpec propertySpec)
 {
     return Filter.GetPropertySetter(propertySpec.ReflectedType, propertySpec.PropertyInfo)
            ?? base.LoadSetter(propertySpec);
 }
예제 #11
0
파일: TypeMapper.cs 프로젝트: Pomona/Pomona
 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);
 }
예제 #12
0
파일: TypeMapper.cs 프로젝트: Pomona/Pomona
 public override PropertyFlags LoadPropertyFlags(PropertySpec propertySpec)
 {
     return Filter.GetPropertyFlags(propertySpec.PropertyInfo) ?? base.LoadPropertyFlags(propertySpec);
 }
예제 #13
0
        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);
            }
        }
예제 #14
0
 public virtual PropertyFlags LoadPropertyFlags(PropertySpec propertySpec)
 {
     if (propertySpec == null) throw new ArgumentNullException("propertySpec");
     return propertySpec.OnLoadPropertyFlags();
 }
예제 #15
0
 public string GetUri(PropertySpec property, object value)
 {
     return "http://todo";
 }
예제 #16
0
 public virtual PropertySetter LoadSetter(PropertySpec propertySpec)
 {
     if (propertySpec == null)
         throw new ArgumentNullException(nameof(propertySpec));
     return propertySpec.OnLoadSetter();
 }
예제 #17
0
 public virtual TypeSpec LoadPropertyType(PropertySpec propertySpec)
 {
     if (propertySpec == null)
         throw new ArgumentNullException(nameof(propertySpec));
     return propertySpec.OnLoadPropertyType();
 }
예제 #18
0
 public virtual PropertySpec LoadBaseDefinition(PropertySpec propertySpec)
 {
     if (propertySpec == null)
         throw new ArgumentNullException(nameof(propertySpec));
     return propertySpec.OnLoadBaseDefinition();
 }
예제 #19
0
 public Action<object, object> LoadSetter(PropertySpec propertySpec)
 {
     if (propertySpec == null) throw new ArgumentNullException("propertySpec");
     return propertySpec.OnLoadSetter();
 }
예제 #20
0
        public virtual TypeSpec LoadReflectedType(PropertySpec propertySpec)
        {
            if (propertySpec == null) throw new ArgumentNullException("propertySpec");

            return propertySpec.OnLoadReflectedType();
        }
예제 #21
0
 public bool PropertyIsSerialized(PropertySpec property)
 {
     return property.IsSerialized;
 }
예제 #22
0
파일: TypeMapper.cs 프로젝트: Pomona/Pomona
 public override TypeSpec LoadDeclaringType(PropertySpec propertySpec)
 {
     if (propertySpec is StructuredProperty)
         return FromType(GetKnownDeclaringType(propertySpec.ReflectedType, propertySpec.PropertyInfo));
     return base.LoadDeclaringType(propertySpec);
 }
예제 #23
0
 public void SetProperty(PropertySpec property, object propertyValue)
 {
     Context.SetProperty(this, property, propertyValue);
 }
예제 #24
0
파일: TypeSpec.cs 프로젝트: Pomona/Pomona
        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;
        }