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

Unnecessary null check #56

Closed
gokhanabatay opened this issue Dec 14, 2022 · 1 comment
Closed

Unnecessary null check #56

gokhanabatay opened this issue Dec 14, 2022 · 1 comment
Labels
wontfix This will not be worked on

Comments

@gokhanabatay
Copy link

gokhanabatay commented Dec 14, 2022

Thank you for great library it saves my time, when we are struggling to migrate nhibernate to ef core 7.
We are storing DateTime as YYYYMMDD formatted in database.

Below projectable generates following sql and it includes unnessary coalesce function why "BirthTime" alread not nullable integer property.

CAST((a.birth_date::text || COALESCE(lpad(a.birth_time::text, 6, '0'), '')) AS bigint) >= @__ToLongDateTime_0

public class Author
{
    public DateTime BirthDate {get; set;}
    public int BirthTime {get; set;}

    [Projectable]
    public long BirthDateTime => (long)(object)(BirthDate + BirthTime.ToString().PadLeft(6, '0'));
}

Details when I try to implement custom function. dotnet/efcore#25980 (comment)

@gokhanabatay gokhanabatay changed the title Unnessary null check Unnecessary null check Dec 14, 2022
@koenbeuk koenbeuk added the wontfix This will not be worked on label Jan 22, 2023
@koenbeuk
Copy link
Owner

The generated SQL is produced by EF, this library does not impact the SQL that gets generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants