コード例 #1
0
        /// <summary>
        ///     Executes a prebuilt <see cref="IScalar{T}" /> and returns a single instance of <typeparamref name="T" />
        /// </summary>
        /// <typeparam name="T">The Entity being queried</typeparam>
        /// <param name="query">The prebuilt Query Object</param>
        /// <returns>The task that will return an instance of <typeparamref name="T" /> from the query</returns>
        public virtual Task <T> FindAsync <T>(IScalar <T> query)
        {
            var task = new Task <T>(() => query.Execute(_context));

            task.Start();
            return(task);
        }
コード例 #2
0
        /// <summary>
        ///     Executes a prebuilt <see cref="IScalar{T}" /> and returns a single instance of <typeparamref name="T" />
        /// </summary>
        /// <typeparam name="T">The Entity being queried</typeparam>
        /// <param name="query">The prebuilt Query Object</param>
        /// <returns>The instance of <typeparamref name="T" /> returned from the query</returns>
        public virtual T Find <T>(IScalar <T> scalar)
        {
            OnBeforeScalar(new BeforeScalar(scalar));
            var result = scalar.Execute(_context);

            OnAfterScalar(new AfterScalar(result));
            return(result);
        }
コード例 #3
0
        /// <summary>
        ///     Executes a prebuilt <see cref="IScalar{T}" /> and returns a single instance of <typeparamref name="T" />
        /// </summary>
        /// <typeparam name="T">The Entity being queried</typeparam>
        /// <param name="query">The prebuilt Query Object</param>
        /// <returns>The instance of <typeparamref name="T" /> returned from the query</returns>
        public virtual T Find <T>(IScalar <T> query)
        {
            OnBeforeScalar(new BeforeScalar(query));
            var result = query.Execute(_context);

            OnAfterScalar(new AfterScalar(query));
            return(result);
        }
コード例 #4
0
        /// <summary>
        ///     Executes a prebuilt <see cref="IScalar{T}" /> and returns a single instance of <typeparamref name="T" />
        /// </summary>
        /// <typeparam name="T">The Entity being queried</typeparam>
        /// <param name="query">The prebuilt Query Object</param>
        /// <returns>The task that will return an instance of <typeparamref name="T" /> from the query</returns>
        public virtual Task <T> FindAsync <T>(IScalar <T> query)
        {
            OnBeforeScalar(new BeforeScalar(query));
            var task = new Task <T>(() => query.Execute(_context)).ContinueWith(t =>
            {
                OnAfterScalar(new AfterScalar(query));
                return(t.Result);
            });

            task.Start();
            return(task);
        }
コード例 #5
0
 /// <summary>
 ///     Executes a prebuilt <see cref="IScalar{T}" /> and returns a single instance of <typeparamref name="T" />
 /// </summary>
 /// <typeparam name="T">The Entity being queried</typeparam>
 /// <param name="query">The prebuilt Query Object</param>
 /// <returns>The instance of <typeparamref name="T" /> returned from the query</returns>
 public virtual T Find <T>(IScalar <T> query)
 {
     return(query.Execute(_context));
 }
コード例 #6
0
ファイル: DataServiceBase.cs プロジェクト: PiSim/LDb2
 public T2 RunQuery <T2>(IScalar <T2, T> queryObject)
 {
     return(queryObject.Execute(_contextFactory.Create()));
 }
コード例 #7
0
 /// <summary>
 ///     Executes a prebuilt <see cref="IScalar{T}" /> and returns a single instance of <typeparamref name="T" />
 /// </summary>
 /// <typeparam name="T">The Entity being queried</typeparam>
 /// <param name="query">The prebuilt Query Object</param>
 /// <returns>The instance of <typeparamref name="T" /> returned from the query</returns>
 public virtual T Find <T>(IScalar <T> query)
 {
     return(query.Execute(Executor));
 }
コード例 #8
0
 /// <summary>
 /// Executes a prebuilt <see cref="IScalar{T}"/> and returns a single instance of <typeparamref name="T"/>
 /// </summary>
 /// <typeparam name="T">The Entity being queried</typeparam>
 /// <param name="query">The prebuilt Query Object</param>
 /// <returns>The instance of <typeparamref name="T"/> returned from the query</returns>
 public T Find <T>(IScalar <T> query)
 {
     return(query.Execute(Context));
 }