This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Decimal Field Default Value not allow 0m #268
Labels
no repro
Can't reproduce. Need sample code that exhibits the issue.
Projects
Comments
msawczyn
added a commit
that referenced
this issue
Feb 11, 2021
Hi @dongjason I'm not quite sure I understand the issue. A property with a Decimal type, and an initial value of 0 in the designer, generates (extra code eliminated for readability)
That's perfectly valid C# and compiles without issue. Are you seeing something different? |
Michael,
Sorry I was side tracked and did not get back to you sooner.
The error was occurring on the generated migration for Migration.AlterColumn statement with defaultvalue: 0 for the decimal fields. What is interesting is now it suddenly generates the Migration.AlterColumn statement with defaultvalue: 0m.
I don’t recall I did anything that could lead to that change. I will keep an eye out for it. Hopefully it will stay good.
Thanks a lot.
Jason
From: Michael Sawczyn<mailto:notifications@github.com>
Sent: Saturday, February 13, 2021 9:49 AM
To: msawczyn/EFDesigner<mailto:EFDesigner@noreply.github.com>
Cc: dongjason<mailto:dong_jason@hotmail.com>; Mention<mailto:mention@noreply.github.com>
Subject: Re: [msawczyn/EFDesigner] Decimal Field Default Value not allow 0m (#268)
Hi @dongjason<https://github.com/dongjason>
I'm not quite sure I understand the issue. A property with a Decimal type, and an initial value of 0 in the designer, generates (extra code eliminated for readability)
public class AnEntity
{
public AnEntity()
{
Property1 = 0;
}
public long Id { get; set; }
public decimal Property1 { get; set; }
}
That's perfectly valid C# and compiles without issue. Are you seeing something different?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#268 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACA4563TKW3YNQBFJ7N4RM3S62GPTANCNFSM4XLJBTEQ>.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
For properties of Decimal type, when I set the initial value to 0, the migration reports an error because it could not set the default value of 0, it expect it to be a literal of 0m. But I could not put 0m in the designer because it think it is not a valid numeric value.
The text was updated successfully, but these errors were encountered: