Inheritance: RuntimePropertySpec
Example #1
0
        private SchemaPropertyEntry GenerateForProperty(StructuredProperty propertyInfo)
        {
            var propType = propertyInfo.PropertyType;

            var propEntry = new SchemaPropertyEntry
            {
                Required = propertyInfo.IsRequiredForConstructor,
                Access = propertyInfo.AccessMode,
                Name = propertyInfo.Name,
                Type = propType.GetSchemaTypeName()
            };

            var enumerablePropType = propType as EnumerableTypeSpec;
            if (enumerablePropType != null)
            {
                propEntry.Items = new List<SchemaArrayItem>
                {
                    new SchemaArrayItem
                    {
                        Type = enumerablePropType.ItemType.GetSchemaTypeName(),
                        Access = propertyInfo.ItemAccessMode
                    }
                };
            }

            var dictPropType = propType as DictionaryTypeSpec;
            if (dictPropType != null && propEntry.Type == "dictionary")
            {
                propEntry.Items = new List<SchemaArrayItem>()
                {
                    new SchemaArrayItem()
                    {
                        Type = dictPropType.ValueType.GetSchemaTypeName(),
                        Access = propertyInfo.ItemAccessMode
                    }
                };
            }

            return propEntry;
        }
 public abstract StructuredPropertyDetails LoadStructuredPropertyDetails(StructuredProperty property);
Example #3
0
        public override StructuredPropertyDetails LoadStructuredPropertyDetails(StructuredProperty property)
        {
            var propInfo = property.PropertyInfo;

            var reflectedType = property.ReflectedType;
            var expandMode = Filter.GetPropertyExpandMode(reflectedType, propInfo);
            var accessMode = Filter.GetPropertyAccessMode(propInfo, property.DeclaringType.Constructor);

            var details = new StructuredPropertyDetails(
                Filter.PropertyIsAttributes(reflectedType, propInfo),
                Filter.PropertyIsEtag(reflectedType, propInfo),
                Filter.PropertyIsPrimaryId(reflectedType, propInfo),
                accessMode.HasFlag(HttpMethod.Get),
                accessMode,
                Filter.GetPropertyItemAccessMode(reflectedType, propInfo),
                expandMode);
            return details;
        }
 public abstract StructuredPropertyDetails LoadStructuredPropertyDetails(StructuredProperty property);
Example #5
0
 protected virtual Func<PomonaContext, PomonaResponse> ResolveGetSingleProperty(ResourcePropertyRoute route,
                                                                                StructuredProperty property,
                                                                                ResourceType resourceType)
 {
     return
         pr =>
             new PomonaResponse(pr,
                                pr.Node.Parent.Query()
                                  .SelectEx(x => x.Apply(property.CreateGetterExpression))
                                  .WrapActionResult(QueryProjection.FirstOrDefault));
 }