public virtual void AddRole(Role role) { Roles.Add(role); role.Users.Add(this); }
public virtual bool RemoveRole(Role role) { Roles.Remove(role); return role.Users.Remove(this); }
/// <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(); } } }