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

Metadata: Schema mismatch in user defined function #9360

Closed
smitpatel opened this issue Aug 8, 2017 · 4 comments
Closed

Metadata: Schema mismatch in user defined function #9360

smitpatel opened this issue Aug 8, 2017 · 4 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@smitpatel
Copy link
Contributor

https://github.com/aspnet/EntityFramework/blob/dev/src/EFCore.Relational/Metadata/Conventions/Internal/RelationalDbFunctionConvention.cs#L37

Above line sets schema for UDF to Model.DefaultSchema if it is not set on attribute & only when the DbFunction is added to the model.

Issues:

  • If the function is found using FunctionFinder via Attribute then OnModelCreating has not run yet so no default schema. Which makes DbFunction.Schema would be null even if the model has default schema.
  • If you define function first and then define default schema then schema will remain null in the function.

We need to pull the logic out of that convention which sets the schema to model's default schema.

@divega
Copy link
Contributor

divega commented Aug 9, 2017

EF Triage: we should make it work the same way it works for tables.

@pmiddleton
Copy link
Contributor

How does it work for tables? I was going to look at this tonight along with the updates for #9303

@smitpatel
Copy link
Contributor Author

https://github.com/aspnet/EntityFramework/blob/dev/src/EFCore.Relational/Metadata/RelationalEntityTypeAnnotations.cs#L113

This is how it works for table. The getter of schema looks into model.

@smitpatel
Copy link
Contributor Author

fixed via 7529563

@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 15, 2017
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview1, 2.1.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

4 participants