コード例 #1
0
 public Link GetById(long id)
 {
     using (var connection = connectionFactory.CreateConnection())
     {
         return(helperService.GetScalarMapped <Link>(connection,
                                                     "SELECT rowid, * " +
                                                     "FROM links " +
                                                     "WHERE rowid=$id", new Parameter("id", id)));
     }
 }
コード例 #2
0
        public User Get(string username, string password)
        {
            using (var connection = connectionFactory.CreateConnection())
            {
                (connection as SqliteConnection).CreateFunction("sha256", (string text, string salt) => Sha256(text + salt));

                return(helperService.GetScalarMapped <User>(connection,
                                                            "SELECT rowid, *" +
                                                            "FROM users " +
                                                            "WHERE Username=$username AND Password=sha256($hash, Salt)",
                                                            new Parameter("username", username),
                                                            new Parameter("hash", Sha256(password))));
            }
        }