/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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)); }
public T2 RunQuery <T2>(IScalar <T2, T> queryObject) { return(queryObject.Execute(_contextFactory.Create())); }
/// <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)); }
/// <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)); }