c# - Web Api OData: A null value was detected in the items of a collection property value -


i want return following records odata:

player {     numbers: [1, null, 3] } 

"numbers" being collection of nullable items (say ienumerable). odata has problem if of items in numbers collection null:

a null value detected in items of collection property value; non-streaming instances of collection types not support null values items.

is there way around it?

i'm using web api odata 2.2 (v3)

thanks, stevo

try defining numbers property this:

public ienumerable<int?> numbers { get; set; }  

i've tested such poco definition in-memory data:

numbers = new int?[]{1,null,2} 

and works fine v4 service written using web api:

numbers: [     1,     null,     2 ], 

i believe should work v3 service.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

gradle error "Cannot convert the provided notation to a File or URI" -