





如果使用使用上面的几个特性还不够的话,你也可以使用LINQ to SQL中的局部方法OnPropertyChanging来进行验证,如下代码所示public partial class Product { partial void OnProductNameChanging(string value) { if (!Char.IsUpper(value[0])) { throw new Exception("Product name must start with an uppercase letter.");} }}| 欢迎光临 苏飞论坛 (http://www.sufeinet.com/) | Powered by Discuz! X3.4 |