Ejemplo n.º 1
0
 /// <summary>
 /// Gets the single object by identifier asynchronously.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 public Task <T> GetSingleByIDAsync(object id)
 {
     return(Session.GetAsync <T>(id));
 }
Ejemplo n.º 2
0
 public Task <object> GetAsync(string entityName, object id, CancellationToken cancellationToken = new CancellationToken())
 {
     return(_session.GetAsync(entityName, id, cancellationToken));
 }
Ejemplo n.º 3
0
 //NOTE: Keep it as extension
 /// <summary>
 /// Return the persistent instance of the given entity name with the given identifier, or null
 /// if there is no such persistent instance. (If the instance, or a proxy for the instance, is
 /// already associated with the session, return that instance or proxy.)
 /// </summary>
 /// <typeparam name="T">The entity class.</typeparam>
 /// <param name="session">The session.</param>
 /// <param name="entityName">The entity name.</param>
 /// <param name="id">The entity identifier.</param>
 /// <param name="cancellationToken">A cancellation token that can be used to cancel the work</param>
 /// <returns>A persistent instance, or <see langword="null" />.</returns>
 public static async Task <T> GetAsync <T>(this IStatelessSession session, string entityName, object id, CancellationToken cancellationToken = default(CancellationToken))
 {
     cancellationToken.ThrowIfCancellationRequested();
     return((T)await(session.GetAsync(entityName, id, cancellationToken)).ConfigureAwait(false));
 }