Inheritance: System.Entity
Exemple #1
0
 public virtual void AddRole(Role role)
 {
     Roles.Add(role);
     role.Users.Add(this);
 }
Exemple #2
0
 public virtual bool RemoveRole(Role role)
 {
     Roles.Remove(role);
     return role.Users.Remove(this);
 }
Exemple #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();
     }
       }
 }