Exemplo n.º 1
0
        /// <summary>
        /// Fetches the property tokens of the specified resource type and base types.
        /// </summary>
        /// <param name="type">Resource type.</param>
        /// <param name="context"><see cref="ZentityContext" /> instance to fetch data with.</param>
        /// <returns>Property tokens.</returns>
        public static IEnumerable <ScalarProperty> FetchPropertyTokens(ResourceType type,
                                                                       ZentityContext context)
        {
            IEnumerable <ScalarProperty> properties = ResourceTypeHelper.FetchResourceTypes(context)
                                                      .Where(resourceType => resourceType.Id == type.Id)
                                                      .SelectMany(resourceType => resourceType.ScalarProperties);

            if (type.BaseType != null)
            {
                properties = properties.Concat(FetchPropertyTokens(type.BaseType, context));
            }
            return(properties);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Fetches the property tokens.
 /// </summary>
 /// <param name="context"><see cref="ZentityContext" /> instance to fetch data with.</param>
 /// <returns>Property tokens.</returns>
 private static IEnumerable <ScalarProperty> FetchPropertyTokens(ZentityContext context)
 {
     return(ResourceTypeHelper.FetchResourceTypes(context)
            .SelectMany(resourceType => resourceType.ScalarProperties));
 }