/// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 protected virtual void Apply([NotNull] PropertyBase propertyBase)
 {
     if (ConfigurationSource.Convention.Overrides(propertyBase.GetFieldInfoConfigurationSource()))
     {
         foreach (var type in propertyBase.DeclaringType.ClrType.GetTypesInHierarchy().ToList())
         {
             var fieldInfo = TryMatchFieldName(type, propertyBase.ClrType, propertyBase.Name);
             if (fieldInfo != null)
             {
                 propertyBase.SetFieldInfo(fieldInfo, ConfigurationSource.Convention, runConventions: false);
                 return;
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 protected virtual void Apply([NotNull] PropertyBase propertyBase)
 {
     if (ConfigurationSource.Convention.Overrides(propertyBase.GetFieldInfoConfigurationSource()))
     {
         var type = propertyBase.DeclaringType.ClrType;
         while (type != null)
         {
             var fieldInfo = TryMatchFieldName(type, propertyBase.ClrType, propertyBase.Name);
             if (fieldInfo != null)
             {
                 propertyBase.SetFieldInfo(fieldInfo, ConfigurationSource.Convention);
                 return;
             }
             type = type.GetTypeInfo().BaseType;
         }
     }
 }