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

[Conventions] Validating conventions should be moved to ModelValidator #4016

Closed
smitpatel opened this issue Dec 9, 2015 · 3 comments
Closed
Labels
area-perf closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-cleanup
Milestone

Comments

@smitpatel
Copy link
Contributor

smitpatel commented Dec 9, 2015

Presently the conventions we run after model is built includes

  1. KeyConvention - throws for shadow key defined by convention
  2. KeyAttributeConvention - throws for composite PK defined using data-annotations and not overridden by fluent api
  3. PropertyMappingValidationConvention - throws for primitive properties which cant be mapped or properties not added to the model
  4. ForeignKeyPropertyDiscoveryConvention - throws for ambiguos foreign key properties

None of above makes any changes to the model, they were defined as convention since they use configuration source and needed to be run on builder. But now we have configuration source defined on metadata instead of builder so we can move above task to ModelValidator step.

Motivation behind this, if there is no primary key defined on entity type then foreignkey which references such entity type will create alternate key by convention. This conventional key will throw exception before ModelValidator is run stating that foreign key references conventional key whereas the real issue with the model is lack of PK.

@AndriySvyryd
Copy link
Member

Also rename Model.Validate() to Model.Build()

@AndriySvyryd
Copy link
Member

AndriySvyryd commented Mar 27, 2018

Refactor the methods in ModelValidator and RelationalModelValidator to improve perf

@ajcvickers
Copy link
Contributor

Poaching

ajcvickers added a commit that referenced this issue May 8, 2019
Issue #4016

Also make sure validation logging is sent to the validation category, which means that `DiagnosticsLoggers` can be removed.

There are some convention that do work and can throw exceptions. These have not been moved.
ajcvickers added a commit that referenced this issue May 8, 2019
Issue #4016

Also make sure validation logging is sent to the validation category, which means that `DiagnosticsLoggers` can be removed.

There are some convention that do work and can throw exceptions. These have not been moved.
ajcvickers added a commit that referenced this issue May 11, 2019
Issue #4016

Also make sure validation logging is sent to the validation category, which means that `DiagnosticsLoggers` can be removed.

There are some convention that do work and can throw exceptions. These have not been moved.
ajcvickers added a commit that referenced this issue May 13, 2019
Issue #4016

Also make sure validation logging is sent to the validation category, which means that `DiagnosticsLoggers` can be removed.

There are some convention that do work and can throw exceptions. These have not been moved.
ajcvickers added a commit that referenced this issue May 13, 2019
Issue #4016

Also make sure validation logging is sent to the validation category, which means that `DiagnosticsLoggers` can be removed.

There are some convention that do work and can throw exceptions. These have not been moved.
ajcvickers added a commit that referenced this issue May 13, 2019
Issue #4016

Also make sure validation logging is sent to the validation category, which means that `DiagnosticsLoggers` can be removed.

There are some convention that do work and can throw exceptions. These have not been moved.
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label May 13, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview6 Jun 5, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview6, 3.0.0 Nov 11, 2019
@ajcvickers ajcvickers removed their assignment Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-perf closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-cleanup
Projects
None yet
Development

No branches or pull requests

4 participants