Ejemplo n.º 1
0
        public static User Create([NotNull] WebApiBorilerplateDbContext dbContext)
        {
            var user = Create <User>(dbContext.Session);

            user.CreatedAt = DateTime.UtcNow;

            return(user);
        }
Ejemplo n.º 2
0
        public static Task <User> FindByEmailAsync(
            [NotNull] WebApiBorilerplateDbContext dbContext,
            [NotNull] string email,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            var query = from user in dbContext.Session.Query <User>()
                        where user.Email == email
                        select user;

            query = query.WithOptions(x =>
            {
                x.SetCacheable(true);
            });

            return(query.SingleOrDefaultAsync(cancellationToken));
        }