0

I have an api which I call that return JSON. This I deserialize to objects using DataContractJsonSerializer.

My JSON can have uint values ranging higher than int.MaxValue so I need to have a uint property on my classes to avoid exception.

This class I use for an entitymodel with codefirst ( Entity framework ).

The problem here is that EF6 does not support uint so I don't even get columns in my table when I update the database.

Now the question is, how can I solve this the most simple way if I want to convert the JSON directly to my model entitys. Something I can do with the serializer to put uint values into int ( I dont really care if it gets negative as long as it works ) or maybe I can somehow got EF to accept my uints..

I can ofcourse use two entities and convert between but Id like to avoid this if possible?`

thanks.

dbc
  • 104,963
  • 20
  • 228
  • 340
Evelie
  • 2,919
  • 2
  • 14
  • 21

1 Answers1

1

Use a long / int64. This is a 64 bit integer an fully supported by EF.

Ben Robinson
  • 21,601
  • 5
  • 62
  • 79