-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a nested lambda to ToTable (#21847)
Obsolete CoreAnnotationNames.DefiningQuery Part of #20409
- Loading branch information
1 parent
eaf272b
commit 2d5c580
Showing
11 changed files
with
172 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
using JetBrains.Annotations; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Metadata.Builders | ||
{ | ||
/// <summary> | ||
/// <para> | ||
/// Instances of this class are returned from methods when using the <see cref="ModelBuilder" /> API | ||
/// and it is not designed to be directly constructed in your application code. | ||
/// </para> | ||
/// </summary> | ||
public class TableBuilder | ||
{ | ||
/// <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> | ||
[EntityFrameworkInternal] | ||
public TableBuilder([NotNull] string name, [CanBeNull] string schema, [NotNull] IMutableEntityType entityType) | ||
{ | ||
EntityType = entityType; | ||
} | ||
|
||
private IMutableEntityType EntityType { [DebuggerStepThrough] get; } | ||
|
||
/// <summary> | ||
/// Configures the table to be ignored by migrations. | ||
/// </summary> | ||
/// <param name="excluded"> A value indicating whether the table should be managed by migrations. </param> | ||
/// <returns> The same builder instance so that multiple calls can be chained. </returns> | ||
public virtual TableBuilder IsExcludedFromMigrations(bool excluded = true) | ||
{ | ||
EntityType.SetIsTableExcludedFromMigrations(excluded); | ||
return this; | ||
} | ||
|
||
#region Hidden System.Object members | ||
|
||
/// <summary> | ||
/// Returns a string that represents the current object. | ||
/// </summary> | ||
/// <returns> A string that represents the current object. </returns> | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public override string ToString() => base.ToString(); | ||
|
||
/// <summary> | ||
/// Determines whether the specified object is equal to the current object. | ||
/// </summary> | ||
/// <param name="obj"> The object to compare with the current object. </param> | ||
/// <returns> <see langword="true"/> if the specified object is equal to the current object; otherwise, <see langword="false"/>. </returns> | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public override bool Equals(object obj) => base.Equals(obj); | ||
|
||
/// <summary> | ||
/// Serves as the default hash function. | ||
/// </summary> | ||
/// <returns> A hash code for the current object. </returns> | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public override int GetHashCode() => base.GetHashCode(); | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using JetBrains.Annotations; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Metadata.Builders | ||
{ | ||
/// <summary> | ||
/// <para> | ||
/// Instances of this class are returned from methods when using the <see cref="ModelBuilder" /> API | ||
/// and it is not designed to be directly constructed in your application code. | ||
/// </para> | ||
/// </summary> | ||
/// <typeparam name="TEntity"> The entity type being configured. </typeparam> | ||
public class TableBuilder<TEntity> : TableBuilder | ||
where TEntity : class | ||
{ | ||
/// <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> | ||
[EntityFrameworkInternal] | ||
public TableBuilder([NotNull] string name, [CanBeNull] string schema, [NotNull] IMutableEntityType entityType) | ||
: base(name, schema, entityType) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Configures the table to be ignored by migrations. | ||
/// </summary> | ||
/// <param name="excluded"> A value indicating whether the table should be managed by migrations. </param> | ||
/// <returns> The same builder instance so that multiple calls can be chained. </returns> | ||
public new virtual TableBuilder<TEntity> IsExcludedFromMigrations(bool excluded = true) | ||
=> (TableBuilder<TEntity>)base.IsExcludedFromMigrations(excluded); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.