Skip to content

Query: Infer type mapping from IDbFunction while translating - #27995

Merged
smitpatel merged 1 commit into
mainfrom
smit/issue27954
May 11, 2022
Merged

Query: Infer type mapping from IDbFunction while translating#27995
smitpatel merged 1 commit into
mainfrom
smit/issue27954

Conversation

@smitpatel

@smitpatel smitpatel commented May 10, 2022

Copy link
Copy Markdown
Contributor
  • We use TypeMapping if configured on the DbFunction, or
  • We try to get it if store type is specified
  • If neither of above work then we do the default type mapping based on return type

Resolves #27954
Resolves #27524

@smitpatel
smitpatel requested review from AndriySvyryd and maumar May 10, 2022 18:59
@smitpatel smitpatel changed the title Query: Configure and use TypeMapping on DbFunction Query: Infer type mapping from IDbFunction while translating May 11, 2022
@smitpatel
smitpatel requested a review from AndriySvyryd May 11, 2022 17:10
@smitpatel
smitpatel merged commit f6988cd into main May 11, 2022
@smitpatel
smitpatel deleted the smit/issue27954 branch May 11, 2022 21:04
modelBuilder
.HasDbFunction(typeof(MyEntity).GetMethod(nameof(MyEntity.Modify)))
.HasName("ModifyDate")
.HasStoreType("datetime")

@roji roji May 16, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😿

Not easy to override this for databases which don't have a datetime store type... In any case, this test seems a bit SQL Server-specific, do we want to move it there?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

HasStoreType(null) should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Function StoreType is ignored for DateTime RelationalMethodCallTranslatorProvider and explicit typeMapping

3 participants