コード例 #1
0
 public IList<Role> GetRoles(User user)
 {
     using (var session = NHibernateHelper.Instance.OpenSession())
     {
         using (var transcation = session.BeginTransaction())
         {
             var roles = session.QueryOver<Role>().Where(x => x.User.Id == user.Id);
             transcation.Commit();
             return roles.List<Role>();
         }
     }
 }
コード例 #2
0
 public bool RegisterUser(User user)
 {
     using (var session = NHibernateHelper.Instance.OpenSession())
     {
         using (var transcation = session.BeginTransaction())
         {
             user.Password = MD5Tool.GetMD5(user.Password);
             session.Save(user);
             transcation.Commit();
             return true;
         }
     }
 }
コード例 #3
0
 public void SetUser(User user)
 {
     User = user;
 }