Interface IReferencedRecordsSelectionEdit
Allows the content of a given record's Cross-Reference, Related Records, or Subform field to be modified. Modification may be made via direct assignment of the IEnumerable<int> Ids property, by calling the Set(params int[]) method with one or more values, or by individual calls to the Add and Remove methods.
Inherited Members
Namespace: Estrelica.Archer.Content
Assembly: Estrelica.Interfaces.dll
Syntax
[StayPublic]
[DoNotObfuscateType]
public interface IReferencedRecordsSelectionEdit : IReferencedRecordsSelection, IObjectValue, IEditableField, IClearable, ISubEditableField, IEditable
Remarks
Note that the selection count will be validated against the field's minimum and maximum selection rules with each alteration of the set, so replacing a single value, e.g. substituting Id y for Id x, by calling Remove(x) followed immediately by Add(y) can result in an InvalidOperationException if the minimum and maximum values are the same (e.g. if both are set to 2). In these cases it is recommended to either call Set() with the full set of desired Ids or create an IEnumerable<int> of the final desired Id set and assign it to the Ids property directly, as both of these approaches will assign the Ids in one atomic operation. No validation of the Ids themselves will occur at the time of assignment, other than to confirm that the Ids are > 0. The remaining rules (i.e. whether content exists for the selected Ids and whether that content exists in the level or levels referenced by this field) will not be verified until the record is sent back to Archer via a call to IContentResolver.Update().
Properties
PendingCommits
Returns an IEnumerable of any pending IArcherContentEdit records that have been prepared for persisting and adding to the field via the AddNewRecord() methods.
Declaration
IEnumerable<IArcherContentEdit> PendingCommits { get; }
Property Value
IEnumerable<IArcherContentEdit> |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
Methods
Add(IArcherRecord)
Adds a new existing referenced record to the selections currently in the field
Declaration
bool Add(IArcherRecord content)
Parameters
IArcherRecord
content
And IArcherRecord representing the referenced record to be added |
Returns
bool
True if successful, false if not |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
Add(int)
Adds a new referenced record to the selections currently in the field, via the record's contentId.
Declaration
bool Add(int contentId)
Parameters
int
contentId
The content Id of the referenced record to be added |
Returns
bool
True if successful, false if not |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
AddNewRecord(IArcherLevel, Action<int>)
Prepares a new record for insertion into Archer and linkage to the current reference field. The new record will be automatically persisted and linked to the reference field at the time the parent record is persisted to Archer via IContentResolver.Update(). Prior to persistence, each newly-added record is maintained in the PendingCommits IEnumerable<IArcherRecord> property, and may be removed from the PendingCommits list via the RemovePendingCommits() method if desired.
Declaration
IArcherContentEdit AddNewRecord(IArcherLevel specificLevel, Action<int> contentIdCallback = null)
Parameters
IArcherLevel
specificLevel
The target level in which the new record is to be created. This is optional for Subform, Related Record, and Single-Level Cross-Reference fields (as the target level is deterministic for those fields) but must be specified in the case of Multi-Level Cross-Reference fields. |
Action<int>
contentIdCallback
An optional callback method which will be invoked with the new record's content Id at the time it is persisted to Archer |
Returns
IArcherContentEdit
An editable IArcherContentEdit record |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
AddNewRecord(Action<int>)
Prepares a new record for insertion into Archer and linkage to the current reference field. The new record will be automatically persisted and linked to the reference field at the time the parent record is persisted to Archer via IContentResolver.Update(). Prior to persistence, each newly-added record is maintained in the PendingCommits IEnumerable<IArcherRecord> property, and may be removed from the PendingCommits list via the RemovePendingCommits() method if desired.
Declaration
IArcherContentEdit AddNewRecord(Action<int> contentIdCallback = null)
Parameters
Action<int>
contentIdCallback
An optional callback method which will be invoked with the new record's content Id at the time it is persisted to Archer |
Returns
IArcherContentEdit
An editable IArcherContentEdit record |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
AddNewRecord(int, Action<int>)
Declaration
IArcherContentEdit AddNewRecord(int specificLevelId, Action<int> contentIdCallback = null)
Parameters
int specificLevelId |
Action<int> contentIdCallback |
Returns
IArcherContentEdit |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
Remove(IArcherRecord)
Removes an existing content IArcherRecord reference from the selections currently in the field
Declaration
bool Remove(IArcherRecord content)
Parameters
IArcherRecord
content
An IArcherRecord representing the referenced record to be removed from the field's selections |
Returns
bool
True if successful, false if not |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
Remove(int)
Removes an existing content Id reference from the selections currently in the field
Declaration
bool Remove(int contentId)
Parameters
int
contentId
The content Id of the referenced record to be removed from the field's selections |
Returns
bool
True if successful, false if not |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
RemovePendingCommit(IArcherContentEdit)
Removes a pending IArcherContentEdit record which was previously created via AddNewRecord()
Declaration
bool RemovePendingCommit(IArcherContentEdit pendingCommit)
Parameters
IArcherContentEdit
pendingCommit
The pending IArcherContentEdit record to be removed |
Returns
bool
True if successful, false if not |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
Set(params IArcherRecord[])
Sets the field's selection of referenced content, replacing any prior selections in the field.
Declaration
void Set(params IArcherRecord[] contents)
Parameters
IArcherRecord[]
contents
A params list of IArcherRecords to be set for the field's referenced record selection |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |
Set(params int[])
Sets the field's selection of referenced content, replacing any prior selections in the field.
Declaration
void Set(params int[] contentIds)
Parameters
int[]
contentIds
A params list of content Ids to be set for the field's referenced record selection |
Exceptions
InvalidOperationException
An InvalidOperationException will be raised if a minimum/maximum selection range is defined for the field and the Ids count is outside that range. |