Skip to content

Commit

Permalink
Remove Obsolete code (#26766)
Browse files Browse the repository at this point in the history
Resolves #22549

Only API which cannot be removed and defining query is left
  • Loading branch information
smitpatel authored Nov 19, 2021
1 parent 911d876 commit bb3e7c6
Show file tree
Hide file tree
Showing 42 changed files with 13 additions and 2,125 deletions.
10 changes: 1 addition & 9 deletions src/EFCore.Proxies/Properties/ProxiesStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/EFCore.Proxies/Properties/ProxiesStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@
<data name="EntityTypeNotFoundShared" xml:space="preserve">
<value>The type '{clrType}' is configured as a shared-type entity type, but the entity type name is not known. Ensure that CreateProxy is called on a DbSet created specifically for the shared-type entity type through use of a 'DbContext.Set' overload that accepts an entity type name.</value>
</data>
<data name="EntityTypeNotFoundWeak" xml:space="preserve">
<value>Cannot create a proxy for '{typeName}' because it is mapped to multiple owned entity types. Proxy creation is not supported for owned types used more than once in the model.</value>
<comment>Obsolete</comment>
</data>
<data name="FieldProperty" xml:space="preserve">
<value>Property '{property}' on entity type '{entityType}' is mapped without a CLR property. 'UseChangeTrackingProxies' requires all entity types to be public, unsealed, have virtual properties, and have a public or protected constructor. 'UseLazyLoadingProxies' requires only the navigation properties be virtual.</value>
</data>
Expand Down
37 changes: 0 additions & 37 deletions src/EFCore.Relational/Diagnostics/CommandCorrelatedEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,6 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics
/// </remarks>
public class CommandCorrelatedEventData : DbContextEventData
{
/// <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="connection">The <see cref="DbConnection" /> being used.</param>
/// <param name="context">The <see cref="DbContext" /> currently being used, to null if not known.</param>
/// <param name="executeMethod">The <see cref="DbCommand" /> method.</param>
/// <param name="commandId">A correlation ID that identifies the <see cref="DbCommand" /> instance being used.</param>
/// <param name="connectionId">A correlation ID that identifies the <see cref="DbConnection" /> instance being used.</param>
/// <param name="async">Indicates whether or not the command was executed asynchronously.</param>
/// <param name="startTime">The start time of this event.</param>
[Obsolete("Use the overload with CommandSource")]
public CommandCorrelatedEventData(
EventDefinitionBase eventDefinition,
Func<EventDefinitionBase, EventData, string> messageGenerator,
DbConnection connection,
DbContext? context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
bool async,
DateTimeOffset startTime)
: this(
eventDefinition,
messageGenerator,
connection,
context,
executeMethod,
commandId,
connectionId,
async,
startTime,
CommandSource.Unknown)
{
}

/// <summary>
/// Constructs the event payload.
/// </summary>
Expand Down
43 changes: 0 additions & 43 deletions src/EFCore.Relational/Diagnostics/CommandEndEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,6 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics
/// </remarks>
public class CommandEndEventData : CommandEventData
{
/// <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="connection">The <see cref="DbConnection" /> being used.</param>
/// <param name="command">The <see cref="DbCommand" />.</param>
/// <param name="context">The <see cref="DbContext" /> currently being used, to null if not known.</param>
/// <param name="executeMethod">The <see cref="DbCommand" /> method.</param>
/// <param name="commandId">A correlation ID that identifies the <see cref="DbCommand" /> instance being used.</param>
/// <param name="connectionId">A correlation ID that identifies the <see cref="DbConnection" /> instance being used.</param>
/// <param name="async">Indicates whether or not the command was executed asynchronously.</param>
/// <param name="logParameterValues">Indicates whether or not the application allows logging of parameter values.</param>
/// <param name="startTime">The start time of this event.</param>
/// <param name="duration">The duration this event.</param>
[Obsolete("Use the overload with CommandSource")]
public CommandEndEventData(
EventDefinitionBase eventDefinition,
Func<EventDefinitionBase, EventData, string> messageGenerator,
DbConnection connection,
DbCommand command,
DbContext? context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
bool async,
bool logParameterValues,
DateTimeOffset startTime,
TimeSpan duration)
: base(
eventDefinition,
messageGenerator,
connection,
command,
context,
executeMethod,
commandId,
connectionId,
async,
logParameterValues,
startTime)
=> Duration = duration;

/// <summary>
/// Constructs the event payload.
/// </summary>
Expand Down
48 changes: 0 additions & 48 deletions src/EFCore.Relational/Diagnostics/CommandErrorEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,6 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics
/// </remarks>
public class CommandErrorEventData : CommandEndEventData, IErrorEventData
{
/// <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="connection">The <see cref="DbConnection" /> being used.</param>
/// <param name="command">The <see cref="DbCommand" /> that was executing when it failed.</param>
/// <param name="context">The <see cref="DbContext" /> currently being used, to null if not known.</param>
/// <param name="executeMethod">The <see cref="DbCommand" /> method that was used to execute the command.</param>
/// <param name="commandId">A correlation ID that identifies the <see cref="DbCommand" /> instance being used.</param>
/// <param name="connectionId">A correlation ID that identifies the <see cref="DbConnection" /> instance being used.</param>
/// <param name="exception">The exception that was thrown when execution failed.</param>
/// <param name="async">Indicates whether or not the command was executed asynchronously.</param>
/// <param name="logParameterValues">Indicates whether or not the application allows logging of parameter values.</param>
/// <param name="startTime">The start time of this event.</param>
/// <param name="duration">The duration this event.</param>
[Obsolete("Use the overload with CommandSource")]
public CommandErrorEventData(
EventDefinitionBase eventDefinition,
Func<EventDefinitionBase, EventData, string> messageGenerator,
DbConnection connection,
DbCommand command,
DbContext? context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
Exception exception,
bool async,
bool logParameterValues,
DateTimeOffset startTime,
TimeSpan duration)
: base(
eventDefinition,
messageGenerator,
connection,
command,
context,
executeMethod,
commandId,
connectionId,
async,
logParameterValues,
startTime,
duration)
{
Exception = exception;
}

/// <summary>
/// Constructs the event payload.
/// </summary>
Expand Down
43 changes: 0 additions & 43 deletions src/EFCore.Relational/Diagnostics/CommandEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,6 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics
/// </remarks>
public class CommandEventData : CommandCorrelatedEventData
{
/// <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="connection">The <see cref="DbConnection" /> being used.</param>
/// <param name="command">The <see cref="DbCommand" />.</param>
/// <param name="context">The <see cref="DbContext" /> currently being used, to null if not known.</param>
/// <param name="executeMethod">The <see cref="DbCommand" /> method.</param>
/// <param name="commandId">A correlation ID that identifies the <see cref="DbCommand" /> instance being used.</param>
/// <param name="connectionId">A correlation ID that identifies the <see cref="DbConnection" /> instance being used.</param>
/// <param name="async">Indicates whether or not the command was executed asynchronously.</param>
/// <param name="logParameterValues">Indicates whether or not the application allows logging of parameter values.</param>
/// <param name="startTime">The start time of this event.</param>
[Obsolete("Use the overload with CommandSource")]
public CommandEventData(
EventDefinitionBase eventDefinition,
Func<EventDefinitionBase, EventData, string> messageGenerator,
DbConnection connection,
DbCommand command,
DbContext? context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
bool async,
bool logParameterValues,
DateTimeOffset startTime)
: this(
eventDefinition,
messageGenerator,
connection,
command,
context,
executeMethod,
commandId,
connectionId,
async,
logParameterValues,
startTime,
CommandSource.Unknown)
{
}

/// <summary>
/// Constructs the event payload.
/// </summary>
Expand Down
46 changes: 0 additions & 46 deletions src/EFCore.Relational/Diagnostics/CommandExecutedEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,6 @@ namespace Microsoft.EntityFrameworkCore.Diagnostics
/// </remarks>
public class CommandExecutedEventData : CommandEndEventData
{
/// <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="connection">The <see cref="DbConnection" /> being used.</param>
/// <param name="command">The <see cref="DbCommand" /> that was executing when it failed.</param>
/// <param name="context">The <see cref="DbContext" /> currently being used, to null if not known.</param>
/// <param name="executeMethod">The <see cref="DbCommand" /> method that was used to execute the command.</param>
/// <param name="commandId">A correlation ID that identifies the <see cref="DbCommand" /> instance being used.</param>
/// <param name="connectionId">A correlation ID that identifies the <see cref="DbConnection" /> instance being used.</param>
/// <param name="result">The result of executing the operation.</param>
/// <param name="async">Indicates whether or not the command was executed asynchronously.</param>
/// <param name="logParameterValues">Indicates whether or not the application allows logging of parameter values.</param>
/// <param name="startTime">The start time of this event.</param>
/// <param name="duration">The duration this event.</param>
[Obsolete("Use the overload with CommandSource")]
public CommandExecutedEventData(
EventDefinitionBase eventDefinition,
Func<EventDefinitionBase, EventData, string> messageGenerator,
DbConnection connection,
DbCommand command,
DbContext? context,
DbCommandMethod executeMethod,
Guid commandId,
Guid connectionId,
object? result,
bool async,
bool logParameterValues,
DateTimeOffset startTime,
TimeSpan duration)
: base(
eventDefinition,
messageGenerator,
connection,
command,
context,
executeMethod,
commandId,
connectionId,
async,
logParameterValues,
startTime,
duration)
=> Result = result;

/// <summary>
/// Constructs the event payload.
/// </summary>
Expand Down
10 changes: 0 additions & 10 deletions src/EFCore.Relational/Diagnostics/RelationalEventId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -635,16 +635,6 @@ private static EventId MakeQueryId(Id id)
public static readonly EventId QueryPossibleUnintendedUseOfEqualsWarning =
MakeQueryId(Id.QueryPossibleUnintendedUseOfEqualsWarning);

/// <summary>
/// A query is using a possibly throwing aggregate operation in a sub-query.
/// </summary>
/// <remarks>
/// This event is in the <see cref="DbLoggerCategory.Query" /> category.
/// </remarks>
[Obsolete]
public static readonly EventId QueryPossibleExceptionWithAggregateOperatorWarning =
MakeQueryId(Id.Obsolete_QueryPossibleExceptionWithAggregateOperatorWarning);

/// <summary>
/// A query is loading multiple related collections without configuring a <see cref="QuerySplittingBehavior" />.
/// </summary>
Expand Down
25 changes: 0 additions & 25 deletions src/EFCore.Relational/Diagnostics/RelationalLoggerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2330,31 +2330,6 @@ private static string QueryPossibleUnintendedUseOfEqualsWarning(EventDefinitionB
return d.GenerateMessage(p.Left.Print(), p.Right.Print());
}

/// <summary>
/// Logs for the <see cref="RelationalEventId.QueryPossibleExceptionWithAggregateOperatorWarning" /> event.
/// </summary>
/// <param name="diagnostics">The diagnostics logger to use.</param>
[Obsolete]
public static void QueryPossibleExceptionWithAggregateOperatorWarning(
this IDiagnosticsLogger<DbLoggerCategory.Query> diagnostics)
{
var definition = RelationalResources.LogQueryPossibleExceptionWithAggregateOperatorWarning(diagnostics);

if (diagnostics.ShouldLog(definition))
{
definition.Log(diagnostics);
}

if (diagnostics.NeedsEventData(definition, out var diagnosticSourceEnabled, out var simpleLogEnabled))
{
var eventData = new EventData(
definition,
(d, p) => ((EventDefinition)d).GenerateMessage());

diagnostics.DispatchEventData(definition, eventData, diagnosticSourceEnabled, simpleLogEnabled);
}
}

/// <summary>
/// Logs for the <see cref="RelationalEventId.MultipleCollectionIncludeWarning" /> event.
/// </summary>
Expand Down
10 changes: 0 additions & 10 deletions src/EFCore.Relational/Diagnostics/RelationalLoggingDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,6 @@ public abstract class RelationalLoggingDefinitions : LoggingDefinitions
[EntityFrameworkInternal]
public EventDefinitionBase? LogPossibleUnintendedUseOfEquals;

/// <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]
[Obsolete]
public EventDefinitionBase? LogQueryPossibleExceptionWithAggregateOperatorWarning;

/// <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
Expand Down
10 changes: 0 additions & 10 deletions src/EFCore.Relational/Migrations/HistoryRepositoryDependencies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public sealed record HistoryRepositoryDependencies
/// injection container, then replace selected services using the 'With...' methods. Do not call
/// the constructor at any point in this process.
/// </remarks>
#pragma warning disable CS0618 // Type or member is obsolete
[EntityFrameworkInternal]
public HistoryRepositoryDependencies(
IRelationalDatabaseCreator databaseCreator,
Expand All @@ -66,7 +65,6 @@ public HistoryRepositoryDependencies(
IRelationalTypeMappingSource typeMappingSource,
ICurrentDbContext currentContext,
IModelRuntimeInitializer modelRuntimeInitializer,
IDiagnosticsLogger<DbLoggerCategory.Model> modelLogger,
IRelationalCommandDiagnosticsLogger commandLogger)
{
DatabaseCreator = databaseCreator;
Expand All @@ -81,10 +79,8 @@ public HistoryRepositoryDependencies(
TypeMappingSource = typeMappingSource;
CurrentContext = currentContext;
ModelRuntimeInitializer = modelRuntimeInitializer;
ModelLogger = modelDependencies.Logger;
CommandLogger = commandLogger;
}
#pragma warning restore CS0618 // Type or member is obsolete

/// <summary>
/// The database creator.
Expand Down Expand Up @@ -146,12 +142,6 @@ public HistoryRepositoryDependencies(
/// </summary>
public IModelRuntimeInitializer ModelRuntimeInitializer { get; init; }

/// <summary>
/// The model logger
/// </summary>
[Obsolete("This is contained in ModelDependencies now.")]
public IDiagnosticsLogger<DbLoggerCategory.Model> ModelLogger { get; init; }

/// <summary>
/// The command logger
/// </summary>
Expand Down
Loading

0 comments on commit bb3e7c6

Please sign in to comment.