Skip to main content

IDbSet

Trait IDbSet 

Source
pub trait IDbSet<T: IEntityType>:
    IQueryable<T>
    + Send
    + Sync {
    // Required methods
    fn add(&mut self, entity: T);
    fn remove_all(&mut self);
    fn remove_at(&mut self, index: usize) -> EFResult<()>;
    fn attach(&mut self, entity: T);
    fn added_entities(&self) -> Vec<&T>;
    fn modified_entities(&self) -> Vec<&T>;
    fn deleted_entities(&self) -> Vec<&T>;
    fn entries_with_state(&self) -> Vec<(&T, EntityState)>;
    fn clear_entries(&mut self);
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
}
Expand description

Interface for manipulating a typed entity collection.

Separates mutation concerns from query concerns (see IQueryable<T>). Implemented by DbSet<T>.

Required Methods§

Source

fn add(&mut self, entity: T)

Adds a new entity to the set in Added state.

Source

fn remove_all(&mut self)

Marks all entities in the set as Deleted.

Source

fn remove_at(&mut self, index: usize) -> EFResult<()>

Marks the entity at the given index as Deleted.

Source

fn attach(&mut self, entity: T)

Attaches an existing entity in Unchanged state.

Source

fn added_entities(&self) -> Vec<&T>

Returns references to entities in Added state.

Source

fn modified_entities(&self) -> Vec<&T>

Returns references to entities in Modified state.

Source

fn deleted_entities(&self) -> Vec<&T>

Returns references to entities in Deleted state.

Source

fn entries_with_state(&self) -> Vec<(&T, EntityState)>

Returns an iterator over entity references and their states.

Source

fn clear_entries(&mut self)

Clears all tracked entries from the set.

Source

fn len(&self) -> usize

Returns the number of tracked entries.

Source

fn is_empty(&self) -> bool

Returns whether the set is empty.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§