Skip to content

Commit

Permalink
More links to conceptual docs
Browse files Browse the repository at this point in the history
Part of #17508
  • Loading branch information
ajcvickers committed Aug 25, 2021
1 parent f64c3c2 commit 5d09d36
Show file tree
Hide file tree
Showing 51 changed files with 925 additions and 166 deletions.
3 changes: 0 additions & 3 deletions src/EFCore/Extensions/ConventionAnnotatableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
Expand Down
772 changes: 628 additions & 144 deletions src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions src/EFCore/Extensions/MutableAnnotatableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
Expand Down
6 changes: 6 additions & 0 deletions src/EFCore/Extensions/TransactionsDatabaseFacadeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public static class TransactionsDatabaseFacadeExtensions
/// <summary>
/// Specifies an existing <see cref="Transaction" /> to be used for database operations.
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
/// <param name="databaseFacade"> The <see cref="DatabaseFacade" /> for the context.</param>
/// <param name="transaction"> The transaction to be used. </param>
public static void EnlistTransaction(this DatabaseFacade databaseFacade, Transaction? transaction)
Expand All @@ -38,6 +41,9 @@ public static void EnlistTransaction(this DatabaseFacade databaseFacade, Transac
/// <summary>
/// Returns the currently enlisted transaction.
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
/// <param name="databaseFacade"> The <see cref="DatabaseFacade" /> for the context.</param>
/// <returns> The currently enlisted transaction. </returns>
public static Transaction? GetEnlistedTransaction(this DatabaseFacade databaseFacade)
Expand Down
7 changes: 3 additions & 4 deletions src/EFCore/Infrastructure/AccessorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ public static class AccessorExtensions
/// <see cref="IInfrastructure{IServiceProvider}" />.
/// </para>
/// <para>
/// This method is typically used by database providers (and other extensions). It is generally
/// not used in application code.
/// </para>
/// <para>
/// <see cref="IInfrastructure{T}" /> is used to hide properties that are not intended to be used in
/// application code but can be used in extension methods written by database providers etc.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-services">Accessing DbContext services</see>.
/// </remarks>
/// <typeparam name="TService"> The type of service to be resolved. </typeparam>
/// <param name="accessor"> The object exposing the service provider. </param>
/// <returns> The requested service. </returns>
Expand Down
3 changes: 3 additions & 0 deletions src/EFCore/Infrastructure/Annotatable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure
/// not used in application code.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-providers">Implementation of database providers and extensions</see>.
/// </remarks>
public class Annotatable : AnnotatableBase, IMutableAnnotatable
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/EFCore/Infrastructure/AnnotatableBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure
/// not used in application code.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-providers">Implementation of database providers and extensions</see>.
/// </remarks>
public class AnnotatableBase : IAnnotatable
{
private SortedDictionary<string, Annotation>? _annotations;
Expand Down
3 changes: 3 additions & 0 deletions src/EFCore/Infrastructure/AnnotatableBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure
/// not used in application code.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-providers">Implementation of database providers and extensions</see>.
/// </remarks>
[DebuggerDisplay("Builder {" + nameof(Metadata) + ",nq}")]
public abstract class AnnotatableBuilder<TMetadata, TModelBuilder> : IConventionAnnotatableBuilder
where TMetadata : ConventionAnnotatable
Expand Down
3 changes: 3 additions & 0 deletions src/EFCore/Infrastructure/Annotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure
/// not used in application code.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-providers">Implementation of database providers and extensions</see>.
/// </remarks>
public class Annotation : IAnnotation
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure
/// A <see cref="IDisposable" /> returned by an <see cref="IConcurrencyDetector" />, which will exit the ongoing
/// critical section when disposed.
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-providers">Implementation of database providers and extensions</see>.
/// </remarks>
public readonly struct ConcurrencyDetectorCriticalSectionDisposer : IDisposable
{
private readonly IConcurrencyDetector _concurrencyDetector;
Expand Down
3 changes: 3 additions & 0 deletions src/EFCore/Infrastructure/ConventionAnnotatable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure
/// not used in application code.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-providers">Implementation of database providers and extensions</see>.
/// </remarks>
public abstract class ConventionAnnotatable : Annotatable, IConventionAnnotatable, IMutableAnnotatable
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/EFCore/Infrastructure/CoreOptionsExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure
/// methods to obtain a new instance with the option changed.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-providers">Implementation of database providers and extensions</see>.
/// </remarks>
public class CoreOptionsExtension : IDbContextOptionsExtension
{
private IServiceProvider? _internalServiceProvider;
Expand Down
56 changes: 56 additions & 0 deletions src/EFCore/Infrastructure/DatabaseFacade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ private IDatabaseFacadeDependencies Dependencies
/// to ensure the database is created using migrations and that all migrations have been applied.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-manage-schemas">Managing database schemas with EF Core</see>
/// and <see href="https://aka.ms/efcore-ensure-created">Database creation APIs</see>.
/// </remarks>
/// <returns> <see langword="true" /> if the database is created, <see langword="false" /> if it already existed. </returns>
public virtual bool EnsureCreated()
=> Dependencies.DatabaseCreator.EnsureCreated();
Expand Down Expand Up @@ -114,6 +118,10 @@ public virtual bool EnsureCreated()
/// to ensure the database is created using migrations and that all migrations have been applied.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-manage-schemas">Managing database schemas with EF Core</see>
/// and <see href="https://aka.ms/efcore-ensure-created">Database creation APIs</see>.
/// </remarks>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <returns>
/// A task that represents the asynchronous save operation. The task result contains <see langword="true" /> if the database is created,
Expand All @@ -138,6 +146,10 @@ public virtual Task<bool> EnsureCreatedAsync(CancellationToken cancellationToken
/// execution of the test/prototype. Note, however, that data in the database is not preserved.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-manage-schemas">Managing database schemas with EF Core</see>
/// and <see href="https://aka.ms/efcore-ensure-created">Database creation APIs</see>.
/// </remarks>
/// <returns> <see langword="true" /> if the database is deleted, <see langword="false" /> if it did not exist. </returns>
public virtual bool EnsureDeleted()
=> Dependencies.DatabaseCreator.EnsureDeleted();
Expand All @@ -157,6 +169,10 @@ public virtual bool EnsureDeleted()
/// execution of the test/prototype. Note, however, that data in the database is not preserved.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-manage-schemas">Managing database schemas with EF Core</see>
/// and <see href="https://aka.ms/efcore-ensure-created">Database creation APIs</see>.
/// </remarks>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <returns>
/// A task that represents the asynchronous save operation. The task result contains <see langword="true" /> if the database is deleted,
Expand All @@ -182,6 +198,9 @@ public virtual Task<bool> EnsureDeletedAsync(CancellationToken cancellationToken
/// up-to-date with regard to schema creation, etc.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-connections">Database connections in EF Core</see>.
/// </remarks>
/// <returns> <see langword="true" /> if the database is available; <see langword="false" /> otherwise. </returns>
public virtual bool CanConnect()
=> Dependencies.DatabaseCreator.CanConnect();
Expand All @@ -202,6 +221,9 @@ public virtual bool CanConnect()
/// up-to-date with regard to schema creation, etc.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-connections">Database connections in EF Core</see>.
/// </remarks>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <returns> <see langword="true" /> if the database is available; <see langword="false" /> otherwise. </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
Expand All @@ -211,6 +233,9 @@ public virtual Task<bool> CanConnectAsync(CancellationToken cancellationToken =
/// <summary>
/// Starts a new transaction.
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
/// <returns>
/// A <see cref="IDbContextTransaction" /> that represents the started transaction.
/// </returns>
Expand All @@ -220,6 +245,9 @@ public virtual IDbContextTransaction BeginTransaction()
/// <summary>
/// Asynchronously starts a new transaction.
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <returns>
/// A task that represents the asynchronous transaction initialization. The task result contains a <see cref="IDbContextTransaction" />
Expand All @@ -238,6 +266,9 @@ public virtual void CommitTransaction()
/// <summary>
/// Applies the outstanding operations in the current transaction to the database.
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <returns> A Task representing the asynchronous operation. </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
Expand All @@ -247,12 +278,18 @@ public virtual Task CommitTransactionAsync(CancellationToken cancellationToken =
/// <summary>
/// Discards the outstanding operations in the current transaction.
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
public virtual void RollbackTransaction()
=> Dependencies.TransactionManager.RollbackTransaction();

/// <summary>
/// Discards the outstanding operations in the current transaction.
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <returns> A Task representing the asynchronous operation. </returns>
/// <exception cref="OperationCanceledException"> If the <see cref="CancellationToken"/> is canceled. </exception>
Expand All @@ -262,6 +299,9 @@ public virtual Task RollbackTransactionAsync(CancellationToken cancellationToken
/// <summary>
/// Creates an instance of the configured <see cref="IExecutionStrategy" />.
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-connection-resiliency">EF Core Connection Resiliency</see>.
/// </remarks>
/// <returns>An <see cref="IExecutionStrategy" /> instance.</returns>
public virtual IExecutionStrategy CreateExecutionStrategy()
=> Dependencies.ExecutionStrategyFactory.Create();
Expand All @@ -284,6 +324,9 @@ public virtual IExecutionStrategy CreateExecutionStrategy()
/// on the returned <see cref="IDbContextTransaction" />.
/// </para>
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
public virtual IDbContextTransaction? CurrentTransaction
=> Dependencies.TransactionManager.CurrentTransaction;

Expand All @@ -306,6 +349,9 @@ public virtual IDbContextTransaction? CurrentTransaction
/// could be left in a corrupted state if <see cref="DbContext.SaveChanges()" /> fails.
/// </para>
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
public virtual bool AutoTransactionsEnabled { get; set; } = true;

/// <summary>
Expand All @@ -323,6 +369,9 @@ public virtual IDbContextTransaction? CurrentTransaction
/// corrupted state if <see cref="DbContext.SaveChanges()" /> fails.
/// </para>
/// </summary>
/// <remarks>
/// For more information, see <see href="https://aka.ms/efcore-docs-transactions">Transactions in EF Core</see>.
/// </remarks>
public virtual bool AutoSavepointsEnabled { get; set; } = true;

/// <summary>
Expand All @@ -340,6 +389,10 @@ public virtual IDbContextTransaction? CurrentTransaction
/// provider to use as part of configuring the context.
/// </para>
/// </summary>
/// <remarks>
/// For more information,
/// <see href="https://aka.ms/efcore-docs-dbcontext">DbContext lifetime, configuration, and initialization</see>.
/// </remarks>
public virtual string? ProviderName
// Needs to be lazy because used from OnModelCreating
=> _context.GetService<IEnumerable<IDatabaseProvider>>()
Expand All @@ -355,6 +408,9 @@ public virtual string? ProviderName
/// not directly exposed in the public API surface.
/// </para>
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-docs-providers">Implementation of database providers and extensions</see>.
/// </remarks>
IServiceProvider IInfrastructure<IServiceProvider>.Instance
=> ((IInfrastructure<IServiceProvider>)_context).Instance;

Expand Down
3 changes: 3 additions & 0 deletions src/EFCore/Infrastructure/DbContextAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ namespace Microsoft.EntityFrameworkCore.Infrastructure
/// Identifies the <see cref="DbContext" /> that a class belongs to. For example, this attribute is used
/// to identify which context a migration applies to.
/// </summary>
/// <remarks>
/// For more information, <see href="https://aka.ms/efcore-manage-schemas">Managing database schemas with EF Cor</see>.
/// </remarks>
[AttributeUsage(AttributeTargets.Class)]
public sealed class DbContextAttribute : Attribute
{
Expand Down
Loading

0 comments on commit 5d09d36

Please sign in to comment.