public override void OverrideConnection(IInternalConnection connection)
{
DebugCheck.NotNull(connection);
// Connection should not be changed once context is initialized
Debug.Assert(_creatingModel == false);
Debug.Assert(_objectContext == null);
connection.AppConfig = AppConfig;
if (connection.ConnectionHasModel
!= _internalConnection.ConnectionHasModel)
{
throw _internalConnection.ConnectionHasModel
? Error.LazyInternalContext_CannotReplaceEfConnectionWithDbConnection()
: Error.LazyInternalContext_CannotReplaceDbConnectionWithEfConnection();
}
_internalConnection.Dispose();
_internalConnection = connection;
}