WCF Service complains about columns marked as rowversion
I am currently playing around with Silverlight3, C# and LinqToSQL . I have build up a database on a SQLExpress Server with some tables for example:
Employees ( Id, Name, DepartmentId, TimeStamp ) Departments ( Id, Name, TimeStamp )
The Id fields are VarChar(50), the Name Fields are VarChar(100) and the TimeStamp fields are of type timestamp.
In my Silverlight solution I have two projects: A server side one, which includes a LinqToSQL model representing the database and a WCFService including methods for querying the objects by linq queries which makes the data accessible by the second project. The second project is a simple Silverlight app which should get the results from the service and show them on a page.
These querys are ok for some objects, others bring up an operation exception (before the querys are even exequted) which says the following: The elements "Byte[] TimeStamp" and "System.String Id" are both marked as rowversion.
I have double checked everything, even deleted these tables from the designer and added them again but no luck, I keep getting these errors. The tables are all nearly identical, but somehow this error only throws on some of them while others are fine. The TimeStamp column is of type Byte[] while the Id column has the type System.String inside the LinqToSQL model. But only TimeStamp is marked as timestamp and is declared as rowversion NOT NULL f开发者_如何学Cor its server data type. The Id column on the other hand has none of the values set which would make me guess why the error concerning this rowversion conflict is thrown. Are there any suggestions what might cause this conflict?
Opening the .dbml file with a texteditor and removing all IsVersion="true" attributes in the problematic Id Nodes solved the problem. The Visual Studio 2008 DBML designer didn't show these properties as enabled even after enabling and disbaling them in the designer.
精彩评论