/// <summary>
 /// Discover the property from the given type.
 /// </summary>
 /// <typeparam name="TEntity">The entity type.</typeparam>
 /// <param name="builder">The parent builder to add to.</param>
 /// <param name="type">The type to discover the properties from.</param>
 void Discover <TEntity>(ContractBuilder <TEntity> builder, TypeInfo type)
 {
     foreach (var property in _fieldDiscovery.Discover(type))
     {
         builder
         .Field(property.Name)
         .Accessor(new RuntimeFieldAccessor(property))
         .Options(RuntimeField.CreateDefaultOptions(property));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Discover the property from the given type.
        /// </summary>
        /// <typeparam name="TEntity">The entity type.</typeparam>
        /// <param name="builder">The parent builder to add to.</param>
        /// <param name="type">The type to discover the properties from.</param>
        static void Discover <TEntity>(ContractBuilder <TEntity> builder, TypeInfo type)
        {
            foreach (var property in type.DeclaredProperties)
            {
                builder
                .Field(property.Name)
                .Accessor(new RuntimeFieldAccessor(property))
                .Options(RuntimeField.CreateDefaultOptions(property));
            }

            if (type.BaseType != null && type.BaseType != typeof(object))
            {
                Discover(builder, type.BaseType.GetTypeInfo());
            }
        }