C# 클래스 System.Data.Entity.Internal.LazyInternalContext

A LazyInternalContext is a concrete InternalContext type that will lazily create the underlying ObjectContext when needed. The ObjectContext created is owned by the internal context and will be disposed when the internal context is disposed.
상속: InternalContext
파일 보기 프로젝트 열기: aspnet/EntityFramework6 1 사용 예제들

공개 메소드들

메소드 설명
CreateModel ( LazyInternalContext internalContext ) : DbCompiledModel

Creates an immutable, cacheable representation of the model defined by this builder. This model can be used to create an ObjectContext or can be passed to a DbContext constructor to create a DbContext for this model.

CreateModelBuilder ( ) : DbModelBuilder

Creates and configures the DbModelBuilder instance that will be used to build the DbCompiledModel.

DisposeContext ( bool disposing ) : void

Disposes the context. The underlying ObjectContext is also disposed. The connection to the database (DbConnection object) is also disposed if it was created by the context, otherwise it is not disposed.

GetObjectContextWithoutDatabaseInitialization ( ) : ObjectContext

Returns the underlying ObjectContext without causing the underlying database to be created or the database initialization strategy to be executed. This is used to get a context that can then be used for database creation/initialization.

LazyInternalContext ( DbContext owner, IInternalConnection internalConnection, DbCompiledModel model, IDbModelCacheKey>.Func cacheKeyFactory = null, System.Data.Entity.ModelConfiguration.Utilities.AttributeProvider attributeProvider = null, Lazy dispatchers = null, ObjectContext objectContext = null ) : System.Collections.Concurrent

Constructs a LazyInternalContext for the given DbContext owner that will be initialized on first use.

MarkDatabaseInitialized ( ) : void

Marks the database as having been initialized without actually running the .

MarkDatabaseNotInitialized ( ) : void

Marks the database as having not been initialized. This is called when the app calls Database.Delete so that the database if the app attempts to then use the database again it will be re-initialized automatically.

OverrideConnection ( IInternalConnection connection ) : void
SaveChanges ( ) : int

Saves all changes made in this context to the underlying database, but only if the context has been initialized. If the context has not been initialized, then this method does nothing because there is nothing to do; in particular, it does not cause the context to be initialized.

SaveChangesAsync ( CancellationToken cancellationToken ) : Task

보호된 메소드들

메소드 설명
InitializeContext ( ) : void

Initializes the underlying ObjectContext.

InitializeDatabase ( ) : void

Runs the IDatabaseInitializer{TContext} unless it has already been run or there is no initializer for this context type in which case this method does nothing.

비공개 메소드들

메소드 설명
InitializeDatabaseAction ( Action action ) : void

Performs some action (which may do nothing) in such a way that it is guaranteed only to be run once for the model and connection in this app domain, unless it fails by throwing an exception, in which case it will be re-tried next time the context is initialized.

StripInvalidCharacters ( string value ) : string

메소드 상세

CreateModel() 공개 정적인 메소드

Creates an immutable, cacheable representation of the model defined by this builder. This model can be used to create an ObjectContext or can be passed to a DbContext constructor to create a DbContext for this model.
public static CreateModel ( LazyInternalContext internalContext ) : DbCompiledModel
internalContext LazyInternalContext
리턴 DbCompiledModel

CreateModelBuilder() 공개 메소드

Creates and configures the DbModelBuilder instance that will be used to build the DbCompiledModel.
public CreateModelBuilder ( ) : DbModelBuilder
리턴 DbModelBuilder

DisposeContext() 공개 메소드

Disposes the context. The underlying ObjectContext is also disposed. The connection to the database (DbConnection object) is also disposed if it was created by the context, otherwise it is not disposed.
public DisposeContext ( bool disposing ) : void
disposing bool
리턴 void

GetObjectContextWithoutDatabaseInitialization() 공개 메소드

Returns the underlying ObjectContext without causing the underlying database to be created or the database initialization strategy to be executed. This is used to get a context that can then be used for database creation/initialization.
public GetObjectContextWithoutDatabaseInitialization ( ) : ObjectContext
리턴 ObjectContext

InitializeContext() 보호된 메소드

Initializes the underlying ObjectContext.
protected InitializeContext ( ) : void
리턴 void

InitializeDatabase() 보호된 메소드

Runs the IDatabaseInitializer{TContext} unless it has already been run or there is no initializer for this context type in which case this method does nothing.
protected InitializeDatabase ( ) : void
리턴 void

LazyInternalContext() 공개 메소드

Constructs a LazyInternalContext for the given DbContext owner that will be initialized on first use.
public LazyInternalContext ( DbContext owner, IInternalConnection internalConnection, DbCompiledModel model, IDbModelCacheKey>.Func cacheKeyFactory = null, System.Data.Entity.ModelConfiguration.Utilities.AttributeProvider attributeProvider = null, Lazy dispatchers = null, ObjectContext objectContext = null ) : System.Collections.Concurrent
owner DbContext // The owner . //
internalConnection IInternalConnection Responsible for creating a connection lazily when the context is used for the first time.
model DbCompiledModel The model, or null if it will be created by convention
cacheKeyFactory IDbModelCacheKey>.Func
attributeProvider System.Data.Entity.ModelConfiguration.Utilities.AttributeProvider
dispatchers Lazy
objectContext ObjectContext
리턴 System.Collections.Concurrent

MarkDatabaseInitialized() 공개 메소드

Marks the database as having been initialized without actually running the .
public MarkDatabaseInitialized ( ) : void
리턴 void

MarkDatabaseNotInitialized() 공개 메소드

Marks the database as having not been initialized. This is called when the app calls Database.Delete so that the database if the app attempts to then use the database again it will be re-initialized automatically.
public MarkDatabaseNotInitialized ( ) : void
리턴 void

OverrideConnection() 공개 메소드

public OverrideConnection ( IInternalConnection connection ) : void
connection IInternalConnection
리턴 void

SaveChanges() 공개 메소드

Saves all changes made in this context to the underlying database, but only if the context has been initialized. If the context has not been initialized, then this method does nothing because there is nothing to do; in particular, it does not cause the context to be initialized.
public SaveChanges ( ) : int
리턴 int

SaveChangesAsync() 공개 메소드

public SaveChangesAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken
리턴 Task