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

Add runtime annotation support to model. #23929

Merged
1 commit merged into from
Jan 26, 2021
Merged

Add runtime annotation support to model. #23929

1 commit merged into from
Jan 26, 2021

Conversation

AndriySvyryd
Copy link
Member

Runtime annotations can only be added to a read-only model and IModelRuntimeInitializer is the service that adds the required ones.
Model validation has been moved to ModelRuntimeInitializer.

Fixes #22031

@smitpatel
Copy link
Member

41/128

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

See some comments below, LGTM but will let @smitpatel finish his review.

Quick question for my understanding... Does the fact that the relational model is now a runtime annotation mean that it will not be part of the compiled model, i.e. would be recalculated every time on program startup?

src/EFCore/Infrastructure/IAnnotatable.cs Outdated Show resolved Hide resolved
src/EFCore/Infrastructure/ModelRuntimeInitializer.cs Outdated Show resolved Hide resolved
src/EFCore/Infrastructure/ModelValidator.cs Show resolved Hide resolved
src/EFCore/Internal/DbContextServices.cs Show resolved Hide resolved
src/EFCore/Metadata/Internal/Model.cs Outdated Show resolved Hide resolved
src/EFCore/Metadata/Internal/Property.cs Outdated Show resolved Hide resolved
@AndriySvyryd
Copy link
Member Author

Quick question for my understanding... Does the fact that the relational model is now a runtime annotation mean that it will not be part of the compiled model, i.e. would be recalculated every time on program startup?

Not necessarily, A runtime annotation cannot be set while the model is building, but the compiled model can recreate it during initialization and I plan to include extension points for providers to affect the compiled model.

@AndriySvyryd
Copy link
Member Author

@smitpatel Do you still want to finish reviewing this?

@smitpatel
Copy link
Member

@AndriySvyryd - Sorry for delay. Moving house was more work than I estimated. (developer issues!). Go ahead with the merging this.

@AndriySvyryd
Copy link
Member Author

I still need a software-friendly approval to be able to merge

@smitpatel
Copy link
Member

Done. I thought Shay already did. These machines are making us do things now-a-days.

  Runtime annotations can only be added to a read-only model and ModelRuntimeInitializer is the service that adds the required ones.
Model validation has been moved to ModelRuntimeInitializer.

Fixes #22031
@ghost
Copy link

ghost commented Jan 25, 2021

Hello @AndriySvyryd!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost
Copy link

ghost commented Jan 26, 2021

Apologies, while this PR appears ready to be merged, I've been configured to only merge when all checks have explicitly passed. The following integrations have not reported any progress on their checks and are blocking auto-merge:

  1. Azure Pipelines

These integrations are possibly never going to report a check, and unblocking auto-merge likely requires a human being to update my configuration to exempt these integrations from requiring a passing check.

Give feedback on this
From the bot dev team

We've tried to tune the bot such that it posts a comment like this only when auto-merge is blocked for exceptional, non-intuitive reasons. When the bot's auto-merge capability is properly configured, auto-merge should operate as you would intuitively expect and you should not see any spurious comments.

Please reach out to us at fabricbotservices@microsoft.com to provide feedback if you believe you're seeing this comment appear spuriously. Please note that we usually are unable to update your bot configuration on your team's behalf, but we're happy to help you identify your bot admin.

@ghost ghost merged commit bca8fa5 into main Jan 26, 2021
@ghost ghost deleted the Issue22031 branch January 26, 2021 00:35
@@ -75,7 +78,10 @@ public Model()
/// </summary>
public Model([NotNull] ConventionSet conventions, [CanBeNull] ModelDependencies? modelDependencies = null)
{
ModelDependencies = modelDependencies;
if (modelDependencies != null)
Copy link
Member

Choose a reason for hiding this comment

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

Should also rename parameter name?

Copy link
Member Author

Choose a reason for hiding this comment

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

It mirrors the type name and there's no ambiguity here. Or is there?

Copy link
Member

Choose a reason for hiding this comment

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

The property name is ScopedModelDependencies. There is so much of inconsistency. :trollface:
I am fine leaving this as is. With introduction of SingletonModelDependencies, sole ModelDependencies feels somewhat ambiguous to me but may not be worth a breaking change. API review should capture this too.

This pull request was closed.
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.

Add runtime annotation support to model
3 participants