pub struct DbContextOptionsBuilder { /* private fields */ }Implementations§
Source§impl DbContextOptionsBuilder
impl DbContextOptionsBuilder
pub fn new() -> Self
pub fn connection_string(&mut self, cs: impl Into<String>) -> &mut Self
pub fn set_provider(&mut self, tag: &str, cs: impl Into<String>) -> &mut Self
pub fn set_provider_factory( &mut self, tag: &str, cs: impl Into<String>, factory: Arc<dyn Fn(&str) -> EFResult<Arc<dyn IDatabaseProvider>> + Send + Sync>, ) -> &mut Self
Sourcepub fn add_interceptor(
&mut self,
interceptor: impl ISaveChangesInterceptor + 'static,
) -> &mut Self
pub fn add_interceptor( &mut self, interceptor: impl ISaveChangesInterceptor + 'static, ) -> &mut Self
Sourcepub fn use_lazy_loading(&mut self, enabled: bool) -> &mut Self
pub fn use_lazy_loading(&mut self, enabled: bool) -> &mut Self
Enables or disables lazy loading of navigation properties.
When enabled (true), to_list() attaches a LazyContext to every
navigation container on each materialized entity. The user can then
call nav.load().await to trigger a single-entity query on first
access; subsequent accesses read from the in-memory cache.
When disabled (false, the default), navigation properties are
empty unless explicitly loaded via Include — matching v1.0
eager-only behavior.
§Example
ⓘ
let mut options = DbContextOptionsBuilder::new();
options.use_sqlite_in_memory().use_lazy_loading(true);Sourcepub fn context_key(&mut self, key: impl Into<String>) -> &mut Self
pub fn context_key(&mut self, key: impl Into<String>) -> &mut Self
Sets the context key used to filter entities and configurations
during DbContext::discover_entities(). Set automatically by
add_dbcontext_keyed; None (the default) selects the default
context.
pub fn build(self) -> DbContextOptions
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for DbContextOptionsBuilder
impl !UnwindSafe for DbContextOptionsBuilder
impl Freeze for DbContextOptionsBuilder
impl Send for DbContextOptionsBuilder
impl Sync for DbContextOptionsBuilder
impl Unpin for DbContextOptionsBuilder
impl UnsafeUnpin for DbContextOptionsBuilder
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