pub struct SaveChangesContext { /* private fields */ }Expand description
Read-only snapshot of the save operation, passed to interceptors.
Built from the actual pending entries across all DbSets (the real save
data source), so interceptors see a snapshot consistent with what
save_changes() will commit. This is an owned snapshot so interceptors
cannot mutate the pending changes, and the borrow does not block
subsequent mutating operations on DbContext.
Implementations§
Source§impl SaveChangesContext
impl SaveChangesContext
Sourcepub fn from_views(entries: Vec<EntityEntryView>) -> Self
pub fn from_views(entries: Vec<EntityEntryView>) -> Self
Creates a context from the pending entries aggregated across all
DbSets. Counts are derived from each entry’s state.
Sourcepub fn entries(&self) -> &[EntityEntryView]
pub fn entries(&self) -> &[EntityEntryView]
Returns all pending entity entries at the time of interception.
Sourcepub fn added_count(&self) -> usize
pub fn added_count(&self) -> usize
Number of entities that will be / were added.
Sourcepub fn modified_count(&self) -> usize
pub fn modified_count(&self) -> usize
Number of entities that will be / were modified.
Sourcepub fn deleted_count(&self) -> usize
pub fn deleted_count(&self) -> usize
Number of entities that will be / were deleted.
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Total number of tracked entries.
Trait Implementations§
Source§impl Clone for SaveChangesContext
impl Clone for SaveChangesContext
Source§fn clone(&self) -> SaveChangesContext
fn clone(&self) -> SaveChangesContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SaveChangesContext
impl RefUnwindSafe for SaveChangesContext
impl Send for SaveChangesContext
impl Sync for SaveChangesContext
impl Unpin for SaveChangesContext
impl UnsafeUnpin for SaveChangesContext
impl UnwindSafe for SaveChangesContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more