1

I already tried with decimal(10,4) and float in the SQL but after I updated my Database model the EF treat

decimal(10,4) as a Decimal in C#
float as a Double in C#

witch for me it's great, but the Model Validation always fail

enter image description here

and it's not because I'm using . instead of ,

enter image description here

What should I do so the validation can run smoothly?

I know I can avoid this using a ModelView in between the View and the Model, but I just want to know how to do things right.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
balexandre
  • 73,608
  • 45
  • 233
  • 342
  • In which type does your Efficiency filed (for example) was defined in your model? – Naor May 26 '11 at 01:02
  • As said above, as `Decimal` and as `Double`, the validation errors are the same :-/ – balexandre May 26 '11 at 06:28
  • When you debug it - can you verify the exception is thrown when inserting the entity? I want to be sure this exception relates to the entity framework. – Naor May 26 '11 at 07:10
  • @Naor, that validation you see in the 1st image is the Model validation, as the jQuery validation sends it correctly, in my action I get `0` instead `675240.72` for the `Turnover` field (and all fields that the validation throws an error). My guess would be the use of `.` instead of `,` but that should be converted automatically in the Model itself. – balexandre May 26 '11 at 07:12

1 Answers1

1

got the problem, it's not me... it's .NET really :)

http://haacked.com/archive/2011/03/19/fixing-binding-to-decimals.aspx

balexandre
  • 73,608
  • 45
  • 233
  • 342