/// <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 string ToDebugString([NotNull] this INavigation navigation, bool singleLine = true, [NotNull] string indent = "") { var builder = new StringBuilder(); builder.Append(indent); if (singleLine) { builder.Append("Navigation: ").Append(navigation.DeclaringEntityType.DisplayName()).Append("."); } builder.Append(navigation.Name); if (navigation.GetFieldName() == null) { builder.Append(" (no field, "); } else { builder.Append(" (").Append(navigation.GetFieldName()).Append(", "); } builder.Append(navigation.ClrType?.ShortDisplayName()).Append(")"); if (navigation.IsCollection()) { builder.Append(" Collection"); } builder.Append(navigation.IsDependentToPrincipal() ? " ToPrincipal " : " ToDependent "); builder.Append(navigation.GetTargetType().DisplayName()); if (navigation.FindInverse() != null) { builder.Append(" Inverse: ").Append(navigation.FindInverse().Name); } if (navigation.GetPropertyAccessMode() != PropertyAccessMode.PreferField) { builder.Append(" PropertyAccessMode.").Append(navigation.GetPropertyAccessMode()); } var indexes = navigation.GetPropertyIndexes(); builder.Append(" ").Append(indexes.Index); builder.Append(" ").Append(indexes.OriginalValueIndex); builder.Append(" ").Append(indexes.RelationshipIndex); builder.Append(" ").Append(indexes.ShadowIndex); builder.Append(" ").Append(indexes.StoreGenerationIndex); if (!singleLine) { builder.Append(navigation.AnnotationsToDebugString(indent + " ")); } return(builder.ToString()); }
/// <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 string ToDebugString( [NotNull] this INavigation navigation, MetadataDebugStringOptions options, [NotNull] string indent = "") { var builder = new StringBuilder(); builder.Append(indent); var singleLine = (options & MetadataDebugStringOptions.SingleLine) != 0; if (singleLine) { builder.Append($"Navigation: {navigation.DeclaringEntityType.DisplayName()}."); } builder.Append(navigation.Name); var field = navigation.GetFieldName(); if (field == null) { builder.Append(" (no field, "); } else if (!field.EndsWith(">k__BackingField", StringComparison.Ordinal)) { builder.Append($" ({field}, "); } else { builder.Append(" ("); } builder.Append(navigation.ClrType?.ShortDisplayName()).Append(")"); if (navigation.IsCollection) { builder.Append(" Collection"); } builder.Append(navigation.IsOnDependent ? " ToPrincipal " : " ToDependent "); builder.Append(navigation.TargetEntityType.DisplayName()); if (navigation.Inverse != null) { builder.Append(" Inverse: ").Append(navigation.Inverse.Name); } if (navigation.GetPropertyAccessMode() != PropertyAccessMode.PreferField) { builder.Append(" PropertyAccessMode.").Append(navigation.GetPropertyAccessMode()); } if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0) { var indexes = navigation.GetPropertyIndexes(); builder.Append(" ").Append(indexes.Index); builder.Append(" ").Append(indexes.OriginalValueIndex); builder.Append(" ").Append(indexes.RelationshipIndex); builder.Append(" ").Append(indexes.ShadowIndex); builder.Append(" ").Append(indexes.StoreGenerationIndex); } if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0) { builder.Append(navigation.AnnotationsToDebugString(indent + " ")); } return(builder.ToString()); }
/// <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 string ToDebugString( [NotNull] this INavigation navigation, bool singleLine = true, bool includeIndexes = false, [NotNull] string indent = "", bool detailed = true) { var builder = new StringBuilder(); builder.Append(indent); if (singleLine) { builder.Append($"Navigation: {navigation.DeclaringEntityType.DisplayName()}."); } builder.Append(navigation.Name); if (!detailed) { return(builder.ToString()); } var field = navigation.GetFieldName(); if (field == null) { builder.Append(" (no field, "); } else if (!field.EndsWith(">k__BackingField", StringComparison.Ordinal)) { builder.Append($" ({field}, "); } else { builder.Append($" ("); } builder.Append(navigation.ClrType?.ShortDisplayName()).Append(")"); if (navigation.IsCollection()) { builder.Append(" Collection"); } builder.Append(navigation.IsDependentToPrincipal() ? " ToPrincipal " : " ToDependent "); builder.Append(navigation.GetTargetType().DisplayName()); if (navigation.FindInverse() != null) { builder.Append(" Inverse: ").Append(navigation.FindInverse().Name); } if (navigation.GetPropertyAccessMode() != PropertyAccessMode.PreferField) { builder.Append(" PropertyAccessMode.").Append(navigation.GetPropertyAccessMode()); } if (includeIndexes) { var indexes = navigation.GetPropertyIndexes(); builder.Append(" ").Append(indexes.Index); builder.Append(" ").Append(indexes.OriginalValueIndex); builder.Append(" ").Append(indexes.RelationshipIndex); builder.Append(" ").Append(indexes.ShadowIndex); builder.Append(" ").Append(indexes.StoreGenerationIndex); } if (!singleLine) { builder.Append(navigation.AnnotationsToDebugString(indent + " ")); } return(builder.ToString()); }