SPPersistedObject and List<T>
- by Sam
Hi
I want sharepoint to "persist" a List of object
I wrote a class SPAlert wich inherit from SPPersistedObject :
public class SMSAlert: SPPersistedObject
{
[Persisted]
private DateTime _scheduledTime;
[Persisted]
private Guid _listId;
[Persisted]
private Guid _siteID;
}
Then I wrote a class wich inherit from SPJobDefinition an add a List of my previous object:
public sealed class MyCustomJob: SPJobDefinition
{
[Persisted]
private List<SMSAlert> _SMSAlerts;
}
The problem is :
when I call the Update method of y MyCustomJob:
myCustomJob.Update();
It throw an exception :
message :
An object in the SharePoint
administrative framework, depends on
other objects which do not exist.
Ensure that all of the objects
dependencies are created and retry
this operation.
stack
at
Microsoft.SharePoint.Administration.SPConfigurationDatabase.StoreObject(SPPersistedObject
obj, Boolean storeClassIfNecessary,
Boolean ensure) at
Microsoft.SharePoint.Administration.SPConfigurationDatabase.PutObject(SPPersistedObject
obj, Boolean ensure) at
Microsoft.SharePoint.Administration.SPPersistedObject.Update()
at
Microsoft.SharePoint.Administration.SPJobDefinition.Update()
at
Sigi.Common.AlertBySMS.SmsAlertHandler.ScheduleJob(SPWeb
web, SPAlertHandlerParams ahp)
inner exception
An object in the SharePoint
administrative framework depends on
other objects which do not exist.
The INSERT statement conflicted with
the FOREIGN KEY constraint
"FK_Dependencies1_Objects".
The conflict occurred in database
"SharePoint_Config, table
"dbo.Objects", column 'Id'. The
statement has been terminated.
Can anyone help me with that??