/// <summary> /// <para> /// Sets the <see cref="PropertyAccessMode" /> to use for navigations of this entity type. /// </para> /// <para> /// Note that individual navigations can override this access mode. The value set here will /// be used for any navigation for which no override has been specified. /// </para> /// </summary> /// <param name="entityType"> The entity type for which to set the access mode. </param> /// <param name="propertyAccessMode"> The <see cref="PropertyAccessMode" />, or <c>null</c> to clear the mode set.</param> public static void SetNavigationAccessMode( [NotNull] this IMutableTypeBase entityType, PropertyAccessMode?propertyAccessMode) { Check.NotNull(entityType, nameof(entityType)); entityType[CoreAnnotationNames.NavigationAccessMode] = propertyAccessMode; }
/// <summary> /// 转为属性键。 /// </summary> /// <param name="propertyType">给定的 <see cref="IMutableTypeBase"/>。</param> /// <returns>返回 <see cref="TypeNamedKey"/>。</returns> public static TypeNamedKey AsPropertyKey(this IMutableTypeBase propertyType) => new(propertyType.ClrType, propertyType.Name);
/// <summary> /// <para> /// Sets the <see cref="PropertyAccessMode" /> to use for navigations of this entity type. /// </para> /// <para> /// Note that individual navigations can override this access mode. The value set here will /// be used for any navigation for which no override has been specified. /// </para> /// </summary> /// <param name="entityType"> The type for which to set the access mode. </param> /// <param name="propertyAccessMode"> The <see cref="PropertyAccessMode" />, or <c>null</c> to clear the mode set.</param> public static void SetNavigationAccessMode( [NotNull] this IMutableTypeBase entityType, PropertyAccessMode?propertyAccessMode) => Check.NotNull(entityType, nameof(entityType)).AsTypeBase() .SetNavigationAccessMode(propertyAccessMode, ConfigurationSource.Explicit);