Class FirestoreDataChangeEvent
Represents a data change event captured from Firestore Realtime Listeners.
public sealed class FirestoreDataChangeEvent
- Inheritance
-
FirestoreDataChangeEvent
- Inherited Members
Properties
ChangeType
Gets the type of change (Added, Modified, Removed).
public FirestoreDataChangeType ChangeType { get; init; }
Property Value
CollectionPath
Gets the collection path this change came from.
public string CollectionPath { get; init; }
Property Value
CreateTime
Gets the document create time from Firestore metadata.
public DateTimeOffset? CreateTime { get; init; }
Property Value
DocumentData
Gets the document data after the change.
public IReadOnlyDictionary<string, object>? DocumentData { get; init; }
Property Value
Remarks
Available for Added and Modified events. Null for Removed events.
DocumentId
Gets the document ID within the collection.
public string DocumentId { get; init; }
Property Value
Position
Gets the position of this change in the stream.
public FirestoreCdcPosition Position { get; init; }
Property Value
Timestamp
Gets the timestamp when the change occurred.
public DateTimeOffset Timestamp { get; init; }
Property Value
UpdateTime
Gets the document update time from Firestore metadata.
public DateTimeOffset? UpdateTime { get; init; }
Property Value
Remarks
This is the server-side timestamp from Firestore, used for position tracking.
Methods
CreateAdded(FirestoreCdcPosition, string, string, IReadOnlyDictionary<string, object>?, DateTimeOffset, DateTimeOffset?, DateTimeOffset?)
Creates a new instance for an added event.
public static FirestoreDataChangeEvent CreateAdded(FirestoreCdcPosition position, string collectionPath, string documentId, IReadOnlyDictionary<string, object>? documentData, DateTimeOffset timestamp, DateTimeOffset? updateTime, DateTimeOffset? createTime)
Parameters
positionFirestoreCdcPositionThe CDC position.
collectionPathstringThe collection path.
documentIdstringThe document ID.
documentDataIReadOnlyDictionary<string, object>The document data.
timestampDateTimeOffsetThe event timestamp.
updateTimeDateTimeOffset?The document update time.
createTimeDateTimeOffset?The document create time.
Returns
- FirestoreDataChangeEvent
A new change event.
CreateModified(FirestoreCdcPosition, string, string, IReadOnlyDictionary<string, object>?, DateTimeOffset, DateTimeOffset?, DateTimeOffset?)
Creates a new instance for a modified event.
public static FirestoreDataChangeEvent CreateModified(FirestoreCdcPosition position, string collectionPath, string documentId, IReadOnlyDictionary<string, object>? documentData, DateTimeOffset timestamp, DateTimeOffset? updateTime, DateTimeOffset? createTime)
Parameters
positionFirestoreCdcPositionThe CDC position.
collectionPathstringThe collection path.
documentIdstringThe document ID.
documentDataIReadOnlyDictionary<string, object>The document data.
timestampDateTimeOffsetThe event timestamp.
updateTimeDateTimeOffset?The document update time.
createTimeDateTimeOffset?The document create time.
Returns
- FirestoreDataChangeEvent
A new change event.
CreateRemoved(FirestoreCdcPosition, string, string, DateTimeOffset)
Creates a new instance for a removed event.
public static FirestoreDataChangeEvent CreateRemoved(FirestoreCdcPosition position, string collectionPath, string documentId, DateTimeOffset timestamp)
Parameters
positionFirestoreCdcPositionThe CDC position.
collectionPathstringThe collection path.
documentIdstringThe document ID.
timestampDateTimeOffsetThe event timestamp.
Returns
- FirestoreDataChangeEvent
A new change event.