Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Decimal Field Default Value not allow 0m #268

Closed
dongjason opened this issue Feb 9, 2021 · 2 comments
Closed

Decimal Field Default Value not allow 0m #268

dongjason opened this issue Feb 9, 2021 · 2 comments
Labels
no repro Can't reproduce. Need sample code that exhibits the issue.
Projects

Comments

@dongjason
Copy link

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.

@msawczyn msawczyn added the bug Confirmed bug label Feb 11, 2021
@msawczyn msawczyn added this to Enhancement Requests in EFDesigner via automation Feb 11, 2021
@msawczyn msawczyn moved this from Enhancement Requests to Bug Reports in EFDesigner Feb 11, 2021
@msawczyn msawczyn added this to the 3.0.4 milestone Feb 11, 2021
@msawczyn msawczyn moved this from Bug Reports to Active in EFDesigner Feb 11, 2021
msawczyn added a commit that referenced this issue Feb 11, 2021
   - Fix to detecting correct EF version with anything with "Latest" in it is configured (see #266)
   - Fix to generate correct initial value code for decimal properties (see #268)
   - Fix for constructor code generation in 1-N unidirectional associations (see #263)
@msawczyn msawczyn added no repro Can't reproduce. Need sample code that exhibits the issue. and removed bug Confirmed bug labels Feb 13, 2021
@msawczyn
Copy link
Owner

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)

    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?

@msawczyn msawczyn removed this from the 3.0.4 milestone Feb 13, 2021
@dongjason
Copy link
Author

dongjason commented Feb 17, 2021 via email

EFDesigner automation moved this from Active to Done Feb 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
no repro Can't reproduce. Need sample code that exhibits the issue.
Projects
EFDesigner
  
Done
Development

No branches or pull requests

2 participants