Example #1
0
 //添加用户名数据
 public void AddUser(User user)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         using (var transaction = session.BeginTransaction())
         {
             session.Save(user);
             transaction.Commit();
         }
     }
 }
Example #2
0
 public List<Role> GetRoleListByUser(User user)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         using (var transaction = session.BeginTransaction())
         {
           var res = session.QueryOver<Role>().Where(role => role.User == user);
             transaction.Commit();
             return (List<Role>) res.List<Role>();
         }
     }
 }