Skip to content

Commit

Permalink
Make ITableMappingBase.IncludesDerivedTypes null if there are no deri…
Browse files Browse the repository at this point in the history
…ved types (#32628)
  • Loading branch information
AndriySvyryd authored Dec 19, 2023
1 parent a36839f commit 8e4dc09
Show file tree
Hide file tree
Showing 34 changed files with 277 additions and 226 deletions.
10 changes: 8 additions & 2 deletions src/EFCore.Relational/Metadata/IFunctionMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@ string ITableMappingBase.ToDebugString(MetadataDebugStringOptions options, int i
builder.Append(" DefaultMapping");
}

if (IncludesDerivedTypes)
if (IncludesDerivedTypes != null)
{
builder.Append(" IncludesDerivedTypes");
builder.Append(' ');
if (!IncludesDerivedTypes.Value)
{
builder.Append('!');
}

builder.Append("IncludesDerivedTypes");
}

if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0)
Expand Down
10 changes: 8 additions & 2 deletions src/EFCore.Relational/Metadata/ISqlQueryMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,15 @@ string ITableMappingBase.ToDebugString(MetadataDebugStringOptions options, int i

builder.Append(Table.Name);

if (IncludesDerivedTypes)
if (IncludesDerivedTypes != null)
{
builder.Append(" IncludesDerivedTypes");
builder.Append(' ');
if (!IncludesDerivedTypes.Value)
{
builder.Append('!');
}

builder.Append("IncludesDerivedTypes");
}

if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ string IColumnBase.ToDebugString(MetadataDebugStringOptions options, int indent)

if (Direction != ParameterDirection.Input)
{
builder.Append(" ").Append(Direction);
builder.Append(' ').Append(Direction);
}

if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0)
Expand Down
10 changes: 8 additions & 2 deletions src/EFCore.Relational/Metadata/IStoredProcedureMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ string ITableMappingBase.ToDebugString(MetadataDebugStringOptions options, int i

builder.Append(" Type:").Append(StoredProcedureIdentifier.StoreObjectType);

if (IncludesDerivedTypes)
if (IncludesDerivedTypes != null)
{
builder.Append(" IncludesDerivedTypes");
builder.Append(' ');
if (!IncludesDerivedTypes.Value)
{
builder.Append('!');
}

builder.Append("IncludesDerivedTypes");
}

if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0)
Expand Down
21 changes: 12 additions & 9 deletions src/EFCore.Relational/Metadata/ITableMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,34 @@ string ITableMappingBase.ToDebugString(MetadataDebugStringOptions options, int i
.Append(" - ")
.Append(Table.Name);

builder.Append(" ");
if (!IncludesDerivedTypes)
if (IncludesDerivedTypes != null)
{
builder.Append("!");
}
builder.Append(' ');
if (!IncludesDerivedTypes.Value)
{
builder.Append('!');
}

builder.Append("IncludesDerivedTypes");
builder.Append("IncludesDerivedTypes");
}

if (IsSharedTablePrincipal != null)
{
builder.Append(" ");
builder.Append(' ');
if (!IsSharedTablePrincipal.Value)
{
builder.Append("!");
builder.Append('!');
}

builder.Append("IsSharedTablePrincipal");
}

if (IsSplitEntityTypePrincipal != null)
{
builder.Append(" ");
builder.Append(' ');
if (!IsSplitEntityTypePrincipal.Value)
{
builder.Append("!");
builder.Append('!');
}

builder.Append("IsSplitEntityTypePrincipal");
Expand Down
29 changes: 16 additions & 13 deletions src/EFCore.Relational/Metadata/ITableMappingBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ public interface ITableMappingBase : IAnnotatable

/// <summary>
/// Gets the value indicating whether this is the mapping for the principal entity type
/// if the table-like object is shared. <see langword="null" /> is the table-like object is not shared.
/// if the table-like object is shared. <see langword="null" /> if the table-like object is not shared.
/// </summary>
bool? IsSharedTablePrincipal { get; }

/// <summary>
/// Gets the value indicating whether this is the mapping for the principal table-like object
/// if the entity type is split. <see langword="null" /> is the entity type is not split.
/// if the entity type is split. <see langword="null" /> if the entity type is not split.
/// </summary>
bool? IsSplitEntityTypePrincipal { get; }

/// <summary>
/// Gets the value indicating whether the mapped table-like object includes rows for the derived entity types.
/// Set to <see langword="false" /> for inherited mappings.
/// Set to <see langword="false" /> for inherited mappings. <see langword="null" /> if the entity type has no derived types.
/// </summary>
bool IncludesDerivedTypes { get; }
bool? IncludesDerivedTypes { get; }

/// <summary>
/// <para>
Expand Down Expand Up @@ -78,31 +78,34 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
.Append(" - ")
.Append(Table.Name);

builder.Append(" ");
if (!IncludesDerivedTypes)
if (IncludesDerivedTypes != null)
{
builder.Append("!");
}
builder.Append(' ');
if (!IncludesDerivedTypes.Value)
{
builder.Append('!');
}

builder.Append("IncludesDerivedTypes");
builder.Append("IncludesDerivedTypes");
}

if (IsSharedTablePrincipal != null)
{
builder.Append(" ");
builder.Append(' ');
if (!IsSharedTablePrincipal.Value)
{
builder.Append("!");
builder.Append('!');
}

builder.Append("IsSharedTablePrincipal");
}

if (IsSplitEntityTypePrincipal != null)
{
builder.Append(" ");
builder.Append(' ');
if (!IsSplitEntityTypePrincipal.Value)
{
builder.Append("!");
builder.Append('!');
}

builder.Append("IsSplitEntityTypePrincipal");
Expand Down
10 changes: 8 additions & 2 deletions src/EFCore.Relational/Metadata/IViewMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ string ITableMappingBase.ToDebugString(MetadataDebugStringOptions options, int i

builder.Append(Table.Name);

if (IncludesDerivedTypes)
if (IncludesDerivedTypes != null)
{
builder.Append(" IncludesDerivedTypes");
builder.Append(' ');
if (!IncludesDerivedTypes.Value)
{
builder.Append('!');
}

builder.Append("IncludesDerivedTypes");
}

if (!singleLine && (options & MetadataDebugStringOptions.IncludeAnnotations) != 0)
Expand Down
2 changes: 1 addition & 1 deletion src/EFCore.Relational/Metadata/Internal/FunctionMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class FunctionMapping : TableMappingBase<FunctionColumnMapping>, IFunctio
/// 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 FunctionMapping(IEntityType entityType, StoreFunction storeFunction, IDbFunction dbFunction, bool includesDerivedTypes)
public FunctionMapping(IEntityType entityType, StoreFunction storeFunction, IDbFunction dbFunction, bool? includesDerivedTypes)
: base(entityType, storeFunction, includesDerivedTypes)
{
DbFunction = dbFunction;
Expand Down
Loading

0 comments on commit 8e4dc09

Please sign in to comment.