예제 #1
0
        /// <summary>
        ///     By default, calls the same method on the wrapped provider.
        /// </summary>
        public virtual TResult Execute <TResult>(Expression expression)
        {
            Check.NotNull(expression, "expression");

            _internalContext.Initialize();

            return(((IQueryProvider)_provider).Execute <TResult>(expression));
        }
예제 #2
0
        /// <summary>
        ///     Returns an <see cref="IDbAsyncEnumerator{TElement}" /> which when enumerated will execute the query against the database.
        /// </summary>
        /// <returns> The query results. </returns>
        public virtual IDbAsyncEnumerator <TElement> GetAsyncEnumerator()
        {
            Debug.Assert(_objectQuery != null, "InternalQuery should have been initialized.");

            InternalContext.Initialize();

            return(((IDbAsyncEnumerable <TElement>)_objectQuery).GetAsyncEnumerator());
        }
예제 #3
0
 /// <summary>
 /// Runs the the registered <see cref="IDatabaseInitializer{TContext}" /> on this context.
 /// If "force" is set to true, then the initializer is run regardless of whether or not it
 /// has been run before.  This can be useful if a database is deleted while an app is running
 /// and needs to be reinitialized.
 /// If "force" is set to false, then the initializer is only run if it has not already been
 /// run for this context, model, and connection in this app domain. This method is typically
 /// used when it is necessary to ensure that the database has been created and seeded
 /// before starting some operation where doing so lazily will cause issues, such as when the
 /// operation is part of a transaction.
 /// </summary>
 /// <param name="force">
 /// If set to <c>true</c> the initializer is run even if it has already been run.
 /// </param>
 public void Initialize(bool force)
 {
     if (force)
     {
         _internalContext.MarkDatabaseInitialized();
         _internalContext.PerformDatabaseInitialization();
     }
     else
     {
         _internalContext.Initialize();
     }
 }