3

Possible Duplicate:
Why isn’t my DbNull a singleton when I deserialise it using XmlSerialiser?

I have an object array that I am passing to a WCF call that has DBNull.Value as one of the values. WCF is apparently choking on it because it doesn't know how to serialize it.

Googling it only shows people who replaced the DBNull.Value with something else. Do I have to do that, or is there a way for me to have DBNull.Value on the client be serialized to the same thing on the server?

Community
  • 1
  • 1
Lurker Indeed
  • 1,521
  • 1
  • 12
  • 21

1 Answers1

2

See this previous post.

Why isn't my DbNull a singleton when I deserialise it using XmlSerialiser?.

Also, as an aside, DBNull probably shouldn't be floating around in your service layer, although there is always a reason sometimes :)

Community
  • 1
  • 1
MattC
  • 3,984
  • 1
  • 33
  • 49
  • yeah, I'd really rather not have it there. My workaround ended up being translating DBNull into something that WCF likes. Don't laugh! – Lurker Indeed Dec 07 '09 at 16:32
  • No laughing here, that's exactly what you should do. Define the contract details and then map either end to conform to those contracts. Ok so DBNull shouldn't be on that side of the service but hey, sometimes you just gotta get it working ;) – MattC Dec 07 '09 at 17:24