提交了 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值