/// <summary> /// Constructs the event payload. /// </summary> /// <param name="eventDefinition"> The event definition. </param> /// <param name="messageGenerator"> A delegate that generates a log message for this event. </param> /// <param name="navigation"> The navigation. </param> public SkipNavigationEventData( EventDefinitionBase eventDefinition, Func <EventDefinitionBase, EventData, string> messageGenerator, IReadOnlySkipNavigation navigation) : base(eventDefinition, messageGenerator) { Navigation = navigation; }
public static string ToDebugString( [NotNull] this IReadOnlySkipNavigation navigation, MetadataDebugStringOptions options, int indent = 0) { var builder = new StringBuilder(); var indentString = new string(' ', indent); builder.Append(indentString); var singleLine = (options & MetadataDebugStringOptions.SingleLine) != 0; if (singleLine) { builder.Append($"SkipNavigation: {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.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 && ((Annotatable)navigation).IsReadOnly) { var indexes = ((ISkipNavigation)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 + 2)); } return(builder.ToString()); }
public static ICollectionLoader GetManyToManyLoader([NotNull] this IReadOnlySkipNavigation navigation) => ((SkipNavigation)navigation).ManyToManyLoader;