提交了 VS 2008 sp1 對 Linq to SQL 的 xml 字段類型支持的一個 bug

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361451

Before vs 2008 sp1, I have a property who's type is XElement in Linq to SQL designer.
I set the 'Server Data Type' value in property grid to 'xml', and it works fine.

However, after installed the sp, it doesn't compile, here is the error message:
---------
Error    27    DBML1005: Mapping between DbType 'xml' and Type 'System.Xml.Linq.XElement' in Column 'Data' of Type 'Sale' is not supported.        0    0    
---------

On the other hand, if I create a new table in SQL Server 2005 with a 'xml' column type, then drag and drop the table from Server Explorer to the dbml designer interface, the entity generated also maps to 'XElement' automatically, and has a 'Server Data Type' of 'Xml', it doesn't compile either.

So I think this is an bug, if there are any walk arounds please tell me. thanks very much.

The third way, if I leave the 'Server Data Type' property to blank, and set the column type in SQL Server 2005 to 'xml' manulely, the project compiles successfully. However, the 'CreateDatabase' method of the DataContext will fail.
here is the code:
===
var db = new testDataContext();
if (! db.DatabaseExists())
    db.CreateDatabase();
===
This will produce the following error:
"無法確定“System.Xml.Linq.XElement”的 SQL 類型。"
(in English maybe it's identical to "The SQL type of 'System.Xml.Linq.XElement' is not sure'.)

This bug makes me very hard to automatically generate database from Linq to SQL side, or the reverse way, both direction need some manual adjustments.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章