-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working implementation of precompiled queries #29949
Closed
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
22c8764
Working implementation of precompiled queries
roji 9d46796
Add try/catch statement support to LinqToCSharpTranslator
roji ca35c12
Some work on LinqToCSharpTranslator
roji dcb7c31
Add support for MemberInit and ListInit
roji d4fd4c3
Support for split queries
roji 4d47e5f
Friendly names for lifted constant variables
roji c32304b
Stop visiting inside identifier queries in QueryLocator
roji 13bf019
Support for ExecuteDelete/Update
roji c16b2f6
Work around anonymous type support
roji 333fdec
Tweaks and simplifications
roji File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
104 changes: 104 additions & 0 deletions
104
src/EFCore.Design/Extensions/Internal/TypeExtensions.cs
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,104 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.CodeAnalysis.CSharp; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Query.Internal; | ||
|
||
internal static class TypeExtensions | ||
{ | ||
internal static TypeSyntax GetTypeSyntax(this Type type) | ||
{ | ||
// TODO: Qualification... | ||
if (type.IsGenericType) | ||
{ | ||
return GenericName( | ||
Identifier(type.Name.Substring(0, type.Name.IndexOf('`'))), | ||
TypeArgumentList(SeparatedList(type.GenericTypeArguments.Select(GetTypeSyntax)))); | ||
} | ||
|
||
if (type == typeof(string)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.StringKeyword)); | ||
} | ||
|
||
if (type == typeof(bool)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.BoolKeyword)); | ||
} | ||
|
||
if (type == typeof(byte)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.ByteKeyword)); | ||
} | ||
|
||
if (type == typeof(sbyte)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.SByteKeyword)); | ||
} | ||
|
||
if (type == typeof(int)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.IntKeyword)); | ||
} | ||
|
||
if (type == typeof(uint)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.UIntKeyword)); | ||
} | ||
|
||
if (type == typeof(short)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.ShortKeyword)); | ||
} | ||
|
||
if (type == typeof(ushort)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.UShortKeyword)); | ||
} | ||
|
||
if (type == typeof(long)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.LongKeyword)); | ||
} | ||
|
||
if (type == typeof(ulong)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.ULongKeyword)); | ||
} | ||
|
||
if (type == typeof(float)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.FloatKeyword)); | ||
} | ||
|
||
if (type == typeof(double)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.DoubleKeyword)); | ||
} | ||
|
||
if (type == typeof(decimal)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.DecimalKeyword)); | ||
} | ||
|
||
if (type == typeof(char)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.CharKeyword)); | ||
} | ||
|
||
if (type == typeof(object)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.ObjectKeyword)); | ||
} | ||
|
||
if (type == typeof(void)) | ||
{ | ||
return PredefinedType(Token(SyntaxKind.VoidKeyword)); | ||
} | ||
|
||
return IdentifierName(type.Name); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @bricelam, can we get the csproj here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you'll need to flow it (
MSBuildProjectFile
) in from dotnet-ef the same way we do projectDir