Exemplo n.º 1
0
        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)..];
Exemplo n.º 2
0
 public static string GetOwnedName([NotNull] this IReadOnlyTypeBase type, [NotNull] string simpleName, [NotNull] string ownershipNavigation)
 => type.Name + "." + ownershipNavigation + "#" + simpleName;
Exemplo n.º 3
0
 /// <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();
Exemplo n.º 4
0
 /// <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();
Exemplo n.º 5
0
 public static PropertyAccessMode GetNavigationAccessMode(
     [NotNull] this IReadOnlyTypeBase typeBase)
 => (PropertyAccessMode?)Check.NotNull(typeBase, nameof(typeBase))[CoreAnnotationNames.NavigationAccessMode]
 ?? typeBase.GetPropertyAccessMode();
Exemplo n.º 6
0
 public static string FullName([NotNull] this IReadOnlyTypeBase type) => type.Name;
Exemplo n.º 7
0
 public static bool IsAbstract([NotNull] this IReadOnlyTypeBase type)
 => type.ClrType.IsAbstract;
Exemplo n.º 8
0
 public static TypeBase AsTypeBase([NotNull] this IReadOnlyTypeBase entityType, [NotNull][CallerMemberName] string methodName = "")
 => MetadataExtensions.AsConcreteMetadataType <IReadOnlyTypeBase, TypeBase>(entityType, methodName);
Exemplo n.º 9
0
 public static PropertyInfo?FindIndexerPropertyInfo([NotNull] this IReadOnlyTypeBase type)
 => ((TypeBase)type).FindIndexerPropertyInfo();