public static string DisplayName([NotNull] this IReadOnlyTypeBase type) { if (!type.HasSharedClrType) { return(type.ClrType.ShortDisplayName()); } var shortName = type.Name; var hashIndex = shortName.IndexOf("#", StringComparison.Ordinal); if (hashIndex == -1) { return(type.Name + " (" + type.ClrType.ShortDisplayName() + ")"); } var plusIndex = shortName.LastIndexOf("+", StringComparison.Ordinal); if (plusIndex != -1) { shortName = shortName[(plusIndex + 1)..];
public static string GetOwnedName([NotNull] this IReadOnlyTypeBase type, [NotNull] string simpleName, [NotNull] string ownershipNavigation) => type.Name + "." + ownershipNavigation + "#" + simpleName;
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public static IReadOnlyDictionary <string, FieldInfo> GetRuntimeFields(this IReadOnlyTypeBase type) => ((TypeBase)type).GetRuntimeFields();
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public static IReadOnlyDictionary <string, PropertyInfo> GetRuntimeProperties(this IReadOnlyTypeBase type) => ((TypeBase)type).GetRuntimeProperties();
public static PropertyAccessMode GetNavigationAccessMode( [NotNull] this IReadOnlyTypeBase typeBase) => (PropertyAccessMode?)Check.NotNull(typeBase, nameof(typeBase))[CoreAnnotationNames.NavigationAccessMode] ?? typeBase.GetPropertyAccessMode();
public static string FullName([NotNull] this IReadOnlyTypeBase type) => type.Name;
public static bool IsAbstract([NotNull] this IReadOnlyTypeBase type) => type.ClrType.IsAbstract;
public static TypeBase AsTypeBase([NotNull] this IReadOnlyTypeBase entityType, [NotNull][CallerMemberName] string methodName = "") => MetadataExtensions.AsConcreteMetadataType <IReadOnlyTypeBase, TypeBase>(entityType, methodName);
public static PropertyInfo?FindIndexerPropertyInfo([NotNull] this IReadOnlyTypeBase type) => ((TypeBase)type).FindIndexerPropertyInfo();