StoreGeneratedPattern Property in ADO.NET Entity Model Designer sets CDSL annotation but not SSDL at...

Using the VS2010 ADO.NET Entity Model Designer for an .EDMX file to set the “StoreGeneratedPattern” Property of a database column (a feature not available at all in the ADO.NET Entity Model Designer of VS2008 SP1 — thanks for exposing that Property in the Designer, but right now it’s dangerous!) and associated Entity Property to “Identity” or “Computed” only sets the “a:StoredGeneratedPattern” Attribute in the Entity Property entry in the CDSL section of the file. It really should also set the “StoredGeneratedPattern” Property on the corresponding database column entry in the SSDL, or the expected behavior will not occur in LINQ-to-Entities code (Properties connected to such columns will not auto-populate after a SaveChanges is performed on the Entity Context, and worse, invalid null or default values will be written to those database fields, OVERWRITING what the database generated!).

 

Remember to always manually add the “StoredGeneratedPattern="(whatever)"” to the SSDL by manually editing the .EDMX in XML Editor mode whenever using (or instead of using, but then you have to add the corresponding annotation to the CDSL as well) the ADO.NET Entity Model Designer Property Window’s “StoredGeneratedPattern” Property, until this bug in the Designer has been fixed.

Failure to do so will result in code that does not function properly, and even can result in serious database value corruption!  

 

 

转载于:https://www.cnblogs.com/silva/archive/2010/05/07/1729822.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值