Skip to content
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

Query: Make CreateReadValueExpression an extension method #20321

Merged
merged 3 commits into from
Mar 18, 2020

Conversation

smitpatel
Copy link
Member

This method is to read a particular index from valueBuffer for a property.
It was in EntityMaterializerSource as an instance method in order for provider to influence how values are read from valueBuffer.
In new query pipeline, providers are supposed to convert valueBuffer read to their database object read. Further, even if they want to create a ValueBuffer for read, the valueBuffer should have values after all custom processing.
Hence there is no particular need to make this overridable behavior. Making it extension method simplify quite a lot of things.

(note: functionality to use this was available anyway since the method it invoke was also publicly exposed as static.

This method is to read a particular index from valueBuffer for a property.
It was in EntityMaterializerSource as an instance method in order for provider to influence how values are read from valueBuffer.
In new query pipeline, providers are supposed to convert valueBuffer read to their database object read. Further, even if they want to create a ValueBuffer for read, the valueBuffer should have values after all custom processing.
Hence there is no particular need to make this overridable behavior. Making it extension method simplify quite a lot of things.

(note: functionality to use this was available anyway since the method it invoke was also publicly exposed as static.
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Utilities;

namespace Microsoft.EntityFrameworkCore.Infrastructure
Copy link
Member

@AndriySvyryd AndriySvyryd Mar 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish this class would have been named something like InternalExpressionExtensions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me too. Such a clash between our own code. 😢

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically we could rename all internal extension method classes without it being a breaking change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but .Infrastructure is not .Internal

@smitpatel
Copy link
Member Author

Is @ajcvickers happy with making this breaking change?

…minatorCondition

If DiscriminatorCondition returns null for IEntityType then return null instance.

Part of #18923
@smitpatel smitpatel linked an issue Mar 18, 2020 that may be closed by this pull request
@ajcvickers
Copy link
Member

It seems okay to me.

/cc @roji @lauxjpn in case it is being used by other providers.

@smitpatel smitpatel merged commit 20481dd into master Mar 18, 2020
@smitpatel smitpatel deleted the smit/ComplexConditions1 branch March 18, 2020 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Query: Define set of conditions for materialization on EntityShaper
3 participants