-
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.
Closes #17311
- Loading branch information
Showing
23 changed files
with
1,238 additions
and
122 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,108 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Linq.Expressions; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Query; | ||
using Microsoft.EntityFrameworkCore.Utilities; | ||
|
||
#nullable disable | ||
|
||
namespace Microsoft.EntityFrameworkCore.Cosmos.Query.Internal | ||
{ | ||
/// <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> | ||
public class FromSqlExpression : RootReferenceExpression, IPrintableExpression | ||
{ | ||
/// <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> | ||
public FromSqlExpression(IEntityType entityType, string alias, string sql, Expression arguments) : base(entityType, alias) | ||
{ | ||
Check.NotEmpty(sql, nameof(sql)); | ||
Check.NotNull(arguments, nameof(arguments)); | ||
|
||
Sql = sql; | ||
Arguments = arguments; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override string Alias => base.Alias!; | ||
|
||
/// <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> | ||
public virtual string Sql { get; } | ||
|
||
/// <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> | ||
public virtual Expression Arguments { get; } | ||
|
||
/// <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> | ||
public virtual FromSqlExpression Update(Expression arguments) | ||
{ | ||
Check.NotNull(arguments, nameof(arguments)); | ||
|
||
return arguments != Arguments | ||
? new FromSqlExpression(EntityType, Alias, Sql, arguments) | ||
: this; | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override Expression VisitChildren(ExpressionVisitor visitor) | ||
{ | ||
Check.NotNull(visitor, nameof(visitor)); | ||
|
||
return this; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override Type Type | ||
=> typeof(object); | ||
|
||
/// <inheritdoc /> | ||
void IPrintableExpression.Print(ExpressionPrinter expressionPrinter) | ||
{ | ||
Check.NotNull(expressionPrinter, nameof(expressionPrinter)); | ||
|
||
expressionPrinter.Append(Sql); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override bool Equals(object obj) | ||
=> obj != null | ||
&& (ReferenceEquals(this, obj) | ||
|| obj is FromSqlExpression fromSqlExpression | ||
&& Equals(fromSqlExpression)); | ||
|
||
private bool Equals(FromSqlExpression fromSqlExpression) | ||
=> base.Equals(fromSqlExpression) | ||
&& Sql == fromSqlExpression.Sql | ||
&& ExpressionEqualityComparer.Instance.Equals(Arguments, fromSqlExpression.Arguments); | ||
|
||
/// <inheritdoc /> | ||
public override int GetHashCode() | ||
=> HashCode.Combine(base.GetHashCode(), Sql); | ||
} | ||
} |
Oops, something went wrong.