未验证 提交 a25593a6 编写于 作者: A Austin Drenski 提交者: GitHub

Add xmldocs for various public members (#786)

Leftovers from PR 617.
上级 f5e6633c
......@@ -8,6 +8,10 @@
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Design.Internal
{
/// <summary>
/// Enables configuring Npgsql-specific design-time services.
/// Tools will automatically discover implementations of this interface that are in the startup assembly.
/// </summary>
[UsedImplicitly]
public class NpgsqlDesignTimeServices : IDesignTimeServices
{
......
......@@ -6,24 +6,23 @@
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Diagnostics
{
/// <summary>
/// <para>
/// Event IDs for PostgreSQL/Npgsql events that correspond to messages logged to an <see cref="ILogger" />
/// and events sent to a <see cref="DiagnosticSource" />.
/// </para>
/// <para>
/// These IDs are also used with <see cref="WarningsConfigurationBuilder" /> to configure the
/// behavior of warnings.
/// </para>
/// <para>
/// Event IDs for PostgreSQL/Npgsql events that correspond to messages logged to an <see cref="ILogger" />
/// and events sent to a <see cref="DiagnosticSource" />.
/// </para>
/// <para>
/// These IDs are also used with <see cref="WarningsConfigurationBuilder" /> to configure the
/// behavior of warnings.
/// </para>
/// </summary>
public static class NpgsqlEventId
{
// Warning: These values must not change between releases.
// Only add new values to the end of sections, never in the middle.
// Try to use <Noun><Verb> naming and be consistent with existing names.
private enum Id
// Try to use {Noun}{Verb} naming and be consistent with existing names.
enum Id
{
// Model validation events
// Scaffolding events
ColumnFound = CoreEventId.ProviderDesignBaseId,
//ColumnNotNamedWarning,
......@@ -57,123 +56,156 @@ private enum Id
UnsupportedConstraintIndexSkippedWarning
}
private static readonly string _validationPrefix = DbLoggerCategory.Model.Validation.Name + ".";
private static EventId MakeValidationId(Id id) => new EventId((int)id, _validationPrefix + id);
// /// <summary>
// /// <para>
// /// No explicit type for a decimal column.
// /// </para>
// /// <para>
// /// This event is in the <see cref="DbLoggerCategory.Model.Validation" /> category.
// /// </para>
// /// <para>
// /// This event uses the <see cref="PropertyEventData" /> payload when used with a <see cref="DiagnosticSource" />.
// /// </para>
// /// </summary>
// public static readonly EventId DecimalTypeDefaultWarning = MakeValidationId(Id.DecimalTypeDefaultWarning);
/// <summary>
/// <para>
/// A byte property is set up to use a SQL Server identity column.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Model.Validation" /> category.
/// </para>
/// <para>
/// This event uses the <see cref="PropertyEventData" /> payload when used with a <see cref="DiagnosticSource" />.
/// </para>
/// </summary>
//public static readonly EventId ByteIdentityColumnWarning = MakeValidationId(Id.ByteIdentityColumnWarning);
private static readonly string _scaffoldingPrefix = DbLoggerCategory.Scaffolding.Name + ".";
private static EventId MakeScaffoldingId(Id id) => new EventId((int)id, _scaffoldingPrefix + id);
static readonly string ScaffoldingPrefix = DbLoggerCategory.Scaffolding.Name + ".";
static EventId MakeScaffoldingId(Id id) => new EventId((int)id, ScaffoldingPrefix + id);
/// <summary>
/// <para>
/// A column was found.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId ColumnFound = MakeScaffoldingId(Id.ColumnFound);
/// <summary>
/// <para>
/// The database is missing a schema.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId MissingSchemaWarning = MakeScaffoldingId(Id.MissingSchemaWarning);
/// <summary>
/// <para>
/// The database is missing a table.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId MissingTableWarning = MakeScaffoldingId(Id.MissingTableWarning);
/// <summary>
/// <para>
/// A foreign key references a missing table at the principal end.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId ForeignKeyReferencesMissingPrincipalTableWarning = MakeScaffoldingId(Id.ForeignKeyReferencesMissingPrincipalTableWarning);
/// <summary>
/// <para>
/// A table was found.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId TableFound = MakeScaffoldingId(Id.TableFound);
/// <summary>
/// <para>
/// A sequence was found.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId SequenceFound = MakeScaffoldingId(Id.SequenceFound);
/// <summary>
/// Primary key was found.
/// <para>
/// A primary key was found.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId PrimaryKeyFound = MakeScaffoldingId(Id.PrimaryKeyFound);
/// <summary>
/// An unique constraint was found.
/// <para>
/// A unique constraint was found.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId UniqueConstraintFound = MakeScaffoldingId(Id.UniqueConstraintFound);
/// <summary>
/// <para>
/// An index was found.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId IndexFound = MakeScaffoldingId(Id.IndexFound);
/// <summary>
/// <para>
/// A foreign key was found.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId ForeignKeyFound = MakeScaffoldingId(Id.ForeignKeyFound);
/// <summary>
/// <para>
/// A principal column referenced by a foreign key was not found.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId ForeignKeyPrincipalColumnMissingWarning = MakeScaffoldingId(Id.ForeignKeyPrincipalColumnMissingWarning);
/// <summary>
/// <para>
/// Enum column cannot be scaffolded, define a CLR enum type and add the property manually.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId EnumColumnSkippedWarning = MakeScaffoldingId(Id.EnumColumnSkippedWarning);
/// <summary>
/// Expression index cannot be scaffolded, expression indices aren't supported and must be added via raw SQL in migrations.
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// <para>
/// Expression index cannot be scaffolded, expression indices aren't supported and must be added via raw SQL in migrations.
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId ExpressionIndexSkippedWarning = MakeScaffoldingId(Id.ExpressionIndexSkippedWarning);
/// <summary>
/// Index '{name}' on table {tableName} cannot be scaffolded because it includes a column that cannot be scaffolded (e.g. enum).
/// <para>
/// Index '{name}' on table {tableName} cannot be scaffolded because it includes a column that cannot be scaffolded (e.g. enum).
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId UnsupportedColumnIndexSkippedWarning = MakeScaffoldingId(Id.UnsupportedColumnIndexSkippedWarning);
/// <summary>
/// Constraint '{name}' on table {tableName} cannot be scaffolded because it includes a column that cannot be scaffolded (e.g. enum).
/// <para>
/// Constraint '{name}' on table {tableName} cannot be scaffolded because it includes a column that cannot be scaffolded (e.g. enum).
/// </para>
/// <para>
/// This event is in the <see cref="DbLoggerCategory.Scaffolding" /> category.
/// </para>
/// </summary>
public static readonly EventId UnsupportedColumnConstraintSkippedWarning = MakeScaffoldingId(Id.UnsupportedConstraintIndexSkippedWarning);
}
......
......@@ -11,20 +11,29 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping
/// </summary>
/// <remarks>
/// Note that mapping PostgreSQL arrays to .NET List{T} is also supported via <see cref="NpgsqlListTypeMapping"/>.
/// See: https://www.postgresql.org/docs/current/static/arrays.html
/// </remarks>
public class NpgsqlArrayTypeMapping : RelationalTypeMapping
{
// ReSharper disable once MemberCanBePrivate.Global
/// <summary>
/// The relational type mapping used to initialize the array mapping.
/// </summary>
public RelationalTypeMapping ElementMapping { get; }
/// <summary>
/// Creates the default array mapping (i.e. for the single-dimensional CLR array type)
/// </summary>
/// <param name="storeType">The database type to map.</param>
/// <param name="elementMapping">The element type mapping.</param>
public NpgsqlArrayTypeMapping(string storeType, RelationalTypeMapping elementMapping)
: this(storeType, elementMapping, elementMapping.ClrType.MakeArrayType()) {}
/// <summary>
/// Creates the default array mapping (i.e. for the single-dimensional CLR array type)
/// </summary>
/// <param name="elementMapping">The element type mapping.</param>
/// <param name="arrayType">The array type to map.</param>
public NpgsqlArrayTypeMapping(RelationalTypeMapping elementMapping, Type arrayType)
: this(elementMapping.StoreType + "[]", elementMapping, arrayType) {}
......
......@@ -6,8 +6,17 @@
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping
{
/// <summary>
/// The type mapping for the PostgreSQL bit string type.
/// </summary>
/// <remarks>
/// See: https://www.postgresql.org/docs/current/static/datatype-bit.html
/// </remarks>
public class NpgsqlBitTypeMapping : NpgsqlTypeMapping
{
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlBitTypeMapping"/> class.
/// </summary>
public NpgsqlBitTypeMapping() : base("bit", typeof(BitArray), NpgsqlDbType.Bit) {}
protected NpgsqlBitTypeMapping(RelationalTypeMappingParameters parameters)
......
......@@ -6,10 +6,19 @@
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping
{
/// <summary>
/// The type mapping for the PostgreSQL hstore type.
/// </summary>
/// <remarks>
/// See: https://www.postgresql.org/docs/current/static/hstore.html
/// </remarks>
public class NpgsqlHstoreTypeMapping : NpgsqlTypeMapping
{
static readonly HstoreComparer ComparerInstance = new HstoreComparer();
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlHstoreTypeMapping"/> class.
/// </summary>
public NpgsqlHstoreTypeMapping()
: base(
new RelationalTypeMappingParameters(
......
......@@ -11,16 +11,23 @@ namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping
/// <summary>
/// Maps PostgreSQL arrays to <see cref="List{T}"/>.
/// </summary>
/// <remarks>
/// Note that mapping PostgreSQL arrays to .NET arrays is also supported via <see cref="NpgsqlArrayTypeMapping"/>.
/// See: https://www.postgresql.org/docs/current/static/arrays.html
/// </remarks>
public class NpgsqlListTypeMapping : RelationalTypeMapping
{
// ReSharper disable once MemberCanBePrivate.Global
/// <summary>
/// The CLR type of the list items.
/// The relational type mapping used to initialize the list mapping.
/// </summary>
public RelationalTypeMapping ElementMapping { get; }
/// <summary>
/// Creates the default list mapping.
/// </summary>
/// <param name="elementMapping">The element type mapping.</param>
/// <param name="listType">The database type to map.</param>
public NpgsqlListTypeMapping(RelationalTypeMapping elementMapping, Type listType)
: this(elementMapping.StoreType + "[]", elementMapping, listType) {}
......@@ -65,7 +72,7 @@ protected override string GenerateNonNullSqlLiteral(object value)
#region Value Comparison
// Note that the value comparison code is largely duplicated from NpgsqlAraryTypeMapping.
// Note that the value comparison code is largely duplicated from NpgsqlArrayTypeMapping.
// However, a limitation in EF Core prevents us from merging the code together, see
// https://github.com/aspnet/EntityFrameworkCore/issues/11077
......
......@@ -6,8 +6,17 @@
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping
{
/// <summary>
/// The type mapping for the PostgreSQL macaddr type.
/// </summary>
/// <remarks>
/// See: https://www.postgresql.org/docs/current/static/datatype-net-types.html#DATATYPE-MACADDR
/// </remarks>
public class NpgsqlMacaddrTypeMapping : NpgsqlTypeMapping
{
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlMacaddrTypeMapping"/> class.
/// </summary>
public NpgsqlMacaddrTypeMapping() : base("macaddr", typeof(PhysicalAddress), NpgsqlDbType.MacAddr) {}
protected NpgsqlMacaddrTypeMapping(RelationalTypeMappingParameters parameters)
......@@ -25,8 +34,17 @@ public override Expression GenerateCodeLiteral(object value)
Expression.Constant(((PhysicalAddress)value).ToString()));
}
/// <summary>
/// The type mapping for the PostgreSQL macaddr8 type.
/// </summary>
/// <remarks>
/// See: https://www.postgresql.org/docs/current/static/datatype-net-types.html#DATATYPE-MACADDR8
/// </remarks>
public class NpgsqlMacaddr8TypeMapping : NpgsqlTypeMapping
{
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlMacaddr8TypeMapping"/> class.
/// </summary>
public NpgsqlMacaddr8TypeMapping() : base("macaddr8", typeof(PhysicalAddress), NpgsqlDbType.MacAddr8) {}
protected NpgsqlMacaddr8TypeMapping(RelationalTypeMappingParameters parameters)
......@@ -44,8 +62,17 @@ public override Expression GenerateCodeLiteral(object value)
Expression.Constant(((PhysicalAddress)value).ToString()));
}
/// <summary>
/// The type mapping for the PostgreSQL inet type.
/// </summary>
/// <remarks>
/// See: https://www.postgresql.org/docs/current/static/datatype-net-types.html#DATATYPE-INET
/// </remarks>
public class NpgsqlInetTypeMapping : NpgsqlTypeMapping
{
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlInetTypeMapping"/> class.
/// </summary>
public NpgsqlInetTypeMapping() : base("inet", typeof(IPAddress), NpgsqlDbType.Inet) {}
protected NpgsqlInetTypeMapping(RelationalTypeMappingParameters parameters)
......@@ -63,8 +90,17 @@ public override Expression GenerateCodeLiteral(object value)
Expression.Constant(((IPAddress)value).ToString()));
}
/// <summary>
/// The type mapping for the PostgreSQL cidr type.
/// </summary>
/// <remarks>
/// See: https://www.postgresql.org/docs/current/static/datatype-net-types.html#DATATYPE-CIDR
/// </remarks>
public class NpgsqlCidrTypeMapping : NpgsqlTypeMapping
{
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlCidrTypeMapping"/> class.
/// </summary>
public NpgsqlCidrTypeMapping() : base("cidr", typeof((IPAddress, int)), NpgsqlDbType.Cidr) {}
protected NpgsqlCidrTypeMapping(RelationalTypeMappingParameters parameters)
......
......@@ -8,12 +8,29 @@
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping
{
/// <summary>
/// The type mapping for the PostgreSQL range types.
/// </summary>
/// <remarks>
/// See: https://www.postgresql.org/docs/current/static/rangetypes.html
/// </remarks>
public class NpgsqlRangeTypeMapping : NpgsqlTypeMapping
{
[NotNull] readonly ISqlGenerationHelper _sqlGenerationHelper;
// ReSharper disable once MemberCanBePrivate.Global
/// <summary>
/// The relational type mapping used to initialize the bound mapping.
/// </summary>
public RelationalTypeMapping SubtypeMapping { get; }
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlRangeTypeMapping"/> class.
/// </summary>
/// <param name="storeType">The database type to map</param>
/// <param name="clrType">The CLR type to map.</param>
/// <param name="subtypeMapping">The type mapping for the range subtype.</param>
/// <param name="sqlGenerationHelper">The SQL generation helper to delimit the store name.</param>
public NpgsqlRangeTypeMapping(
[NotNull] string storeType,
[NotNull] Type clrType,
......@@ -21,6 +38,14 @@ public class NpgsqlRangeTypeMapping : NpgsqlTypeMapping
[NotNull] ISqlGenerationHelper sqlGenerationHelper)
: this(storeType, null, clrType, subtypeMapping, sqlGenerationHelper) {}
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlRangeTypeMapping"/> class.
/// </summary>
/// <param name="storeType">The database type to map</param>
/// <param name="storeTypeSchema">The schema of the type.</param>
/// <param name="clrType">The CLR type to map.</param>
/// <param name="subtypeMapping">The type mapping for the range subtype.</param>
/// <param name="sqlGenerationHelper">The SQL generation helper to delimit the store name.</param>
public NpgsqlRangeTypeMapping(
[NotNull] string storeType,
[CanBeNull] string storeTypeSchema,
......
......@@ -6,11 +6,23 @@
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping
{
/// <summary>
/// The base class for mapping Npgsql-specific types.
/// </summary>
public abstract class NpgsqlTypeMapping : RelationalTypeMapping
{
/// <summary>
/// The database type used by Npgsql.
/// </summary>
public NpgsqlDbType NpgsqlDbType { get; }
// ReSharper disable once PublicConstructorInAbstractClass
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlTypeMapping"/> class.
/// </summary>
/// <param name="storeType">The database type to map.</param>
/// <param name="clrType">The CLR type to map.</param>
/// <param name="npgsqlDbType">The database type used by Npgsql.</param>
public NpgsqlTypeMapping(
[NotNull] string storeType,
[NotNull] Type clrType,
......@@ -18,6 +30,11 @@ public abstract class NpgsqlTypeMapping : RelationalTypeMapping
: base(storeType, clrType)
=> NpgsqlDbType = npgsqlDbType;
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlTypeMapping"/> class.
/// </summary>
/// <param name="parameters">The parameters for this mapping.</param>
/// <param name="npgsqlDbType">The database type of the range subtype.</param>
protected NpgsqlTypeMapping(RelationalTypeMappingParameters parameters, NpgsqlDbType npgsqlDbType)
: base(parameters)
=> NpgsqlDbType = npgsqlDbType;
......
......@@ -10,6 +10,9 @@
namespace Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal
{
/// <summary>
/// The Npgsql-specific implementation for <see cref="ModificationCommandBatch" />.
/// </summary>
/// <remarks>
/// The usual ModificationCommandBatch implementation is <see cref="AffectedCountModificationCommandBatch"/>,
/// which selects the number of rows modified via a SQL query.
......@@ -28,6 +31,14 @@ public class NpgsqlModificationCommandBatch : ReaderModificationCommandBatch
readonly int _maxBatchSize;
long _parameterCount;
/// <summary>
/// Constructs an instance of the <see cref="NpgsqlModificationCommandBatch"/> class.
/// </summary>
/// <param name="commandBuilderFactory">The builder to build commands.</param>
/// <param name="sqlGenerationHelper">A helper for SQL generation.</param>
/// <param name="updateSqlGenerator">A SQL generator for insert, update, and delete commands.</param>
/// <param name="valueBufferFactoryFactory">A factory for creating <see cref="ValueBuffer" /> factories.</param>
/// <param name="maxBatchSize">The maximum count of commands to batch.</param>
public NpgsqlModificationCommandBatch(
[NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
[NotNull] ISqlGenerationHelper sqlGenerationHelper,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册