UPDATE2: OK, I figured this one out. Wow!
The problem had to do with WinSpace’s GetXsdType() function. In my database table, I am using a rowversion (aka timestamp) column per reading Rick Stahl’s weblog dealing with serializing and updating LINQ entities, and the generated DBML data type was “System.Data.Linq.Binary”, which wasn’t accounted for in that GetXsdType() function.
There was some groping around while I determined how to convert the rowversion value (ex: “0000000000000BBB”) to the correct output value in the XML. Which native XSD type to use? I am no expert with schemas, serialization, binary, etc. so I tried hexBinary and base64Binary before finally settling on long as per this MSFT article. Then I created a little custom function to convert the LINQ value to the appropriate hex string using the System.Data.Linq.Binary.ToArray() method.
Now I get the Version output from the web service as follows:
<Version>0000000000000BBB</Version>
Voila! A day gone, but I learned a lot.
UPDATE: This is a thorny one. Here are the debugging steps I’ve taken so far:
- First, I ran WinSpace’s code separately. I had to download the Northwind sample database from Microsoft. That worked just fine.
- On the theory that my code was not including some required serialization routines, I commented out just about everything I could in WinSpace’s code, but his still worked and mine didn’t.
- On the theory that it had to do with his code running in a Website project while mine was in a Web Application Project (which referenced a Class Library), I created my own test Website project. Still no go.
- On the theory that it had something do to with the database, I created a LINQ-to-SQL .dbml file for the Northwind database in my own application. That worked!
Huh. So now I’m down to figuring out what it is about the generated .dbml files that are different.
I’m trying to integrate WinSpace’s excellent Linq serialization code into a new project but am getting an error when I try to run the web service:
The code is fairly straightforward:
[WebMethod]
public List<SerializableEntity<Person>> GetAll()
{
MyDataContext dc = new MyDataContext();
var persons = (from p in dc.Persons
select p).ToList<Person, SerializableEntity<Person>>();
return persons;
}
Not sure what I’m doing wrong here.









