ChangeConflictException 类
继承层次结构
System.Object
System.Exception
Microsoft.SharePoint.Linq.ChangeConflictException
命名空间: Microsoft.SharePoint.Linq
程序集: Microsoft.SharePoint.Linq(位于 Microsoft.SharePoint.Linq.dll 中)
语法
声明
<SerializableAttribute> _
Public Class ChangeConflictException _
Inherits Exception
用法
Dim instance As ChangeConflictException
[SerializableAttribute]
public class ChangeConflictException : Exception
备注
当它检测到并发冲突时, SubmitChanges()将引发此异常。始终,您的代码应该捕获和解决矛盾。有关冲突的解决方案的详细信息,请参阅How to: Write to the Content Databases Using LINQ to SharePoint。
示例
下面是一个简单的示例捕获此异常,并解决矛盾。
foreach (TeamMember teamMember in teamSite.TeamMembers)
{
teamMember.TopTask = "Fiscal Planning";
}
try
{
teamSite.SubmitChanges();
}
catch (ChangeConflictException e)
{
teamSite.ChangeConflicts.ResolveAll();
teamSite.SubmitChanges();
}
For Each teamMember As TeamMember In teamSite.TeamMembers
teamMember.TopTask = "Fiscal Planning"
Next teamMember
Try
teamSite.SubmitChanges()
Catch e As ChangeConflictException
teamSite.ChangeConflicts.ResolveAll()
teamSite.SubmitChanges()
End Try
线程安全性
该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。