Skip to content

Commit

Permalink
Fix breaking changes affecting SapientGuardian MySQL provider
Browse files Browse the repository at this point in the history
Issue dotnet#6926

Add back obsolete parameterless constructors and make logging conditional.
  • Loading branch information
ajcvickers committed Nov 9, 2016
1 parent 3435161 commit 539c9e6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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;
using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
Expand All @@ -27,6 +28,15 @@ private static readonly MethodInfo _methodInfo
private static readonly MethodInfo _concat
= typeof(string).GetRuntimeMethod(nameof(string.Concat), new[] { typeof(string), typeof(string) });

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
[Obsolete("Use constructor ContainsTranslator(ILogger) instead.")]
public ContainsTranslator()
{
}

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
Expand All @@ -48,7 +58,7 @@ public virtual Expression Translate(MethodCallExpression methodCallExpression)

if (ReferenceEquals(methodCallExpression.Method, _methodInfo))
{
_logger.LogWarning(
_logger?.LogWarning(
RelationalEventId.PossibleIncorrectResultsUsingLikeOperator,
() => RelationalStrings.PossibleIncorrectResultsUsingLikeOperator(
nameof(string.Contains)));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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;
using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
Expand All @@ -27,6 +28,15 @@ private static readonly MethodInfo _methodInfo
private static readonly MethodInfo _concat
= typeof(string).GetRuntimeMethod(nameof(string.Concat), new[] { typeof(string), typeof(string) });

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
[Obsolete("Use constructor EndsWithTranslator(ILogger) instead.")]
public EndsWithTranslator()
{
}

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
Expand All @@ -48,7 +58,7 @@ public virtual Expression Translate(MethodCallExpression methodCallExpression)

if (ReferenceEquals(methodCallExpression.Method, _methodInfo))
{
_logger.LogWarning(
_logger?.LogWarning(
RelationalEventId.PossibleIncorrectResultsUsingLikeOperator,
() => RelationalStrings.PossibleIncorrectResultsUsingLikeOperator(
nameof(string.EndsWith)));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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;
using System.Linq.Expressions;
using System.Reflection;
using JetBrains.Annotations;
Expand All @@ -27,6 +28,15 @@ private static readonly MethodInfo _methodInfo
private static readonly MethodInfo _concat
= typeof(string).GetRuntimeMethod(nameof(string.Concat), new[] { typeof(string), typeof(string) });

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
/// </summary>
[Obsolete("Use constructor StartsWithTranslator(ILogger) instead.")]
public StartsWithTranslator()
{
}

/// <summary>
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
/// directly from your code. This API may change or be removed in future releases.
Expand All @@ -48,7 +58,7 @@ public virtual Expression Translate(MethodCallExpression methodCallExpression)

if (ReferenceEquals(methodCallExpression.Method, _methodInfo))
{
_logger.LogWarning(
_logger?.LogWarning(
RelationalEventId.PossibleIncorrectResultsUsingLikeOperator,
() => RelationalStrings.PossibleIncorrectResultsUsingLikeOperator(
nameof(string.StartsWith)));
Expand Down

0 comments on commit 539c9e6

Please sign in to comment.