Inheritance: System.Entity
示例#1
0
文件: Users.cs 项目: sztupy/shaml
 public virtual void AddRole(Role role)
 {
     Roles.Add(role);
     role.Users.Add(this);
 }
示例#2
0
文件: Users.cs 项目: sztupy/shaml
 public virtual bool RemoveRole(Role role)
 {
     Roles.Remove(role);
     return role.Users.Remove(this);
 }
示例#3
0
 /// <summary>
 /// RoleProvider.CreateRole
 /// </summary>
 public override void CreateRole(string roleName)
 {
     if (RoleExists(roleName))
       {
     throw new ProviderException(string.Format(CultureInfo.InvariantCulture, "RoleAlreadyExist {1}", roleName));
       }
       using (var s = NHOpenIDMembershipProvider.GetNHibernateSession())
       {
     using (s.BeginTransaction())
     {
       Role r = new Role();
       r.Name = roleName;
       r.ApplicationName = m_applicationName;
       s.Save(r);
       s.Transaction.Commit();
     }
       }
 }