コード例 #1
0
ファイル: Repository.cs プロジェクト: JoseMilhazes/DSS4
 public void DeleteApplicationRole(zAppDev.DotNet.Framework.Identity.Model.ApplicationRole applicationrole, bool doNotCallDeleteForThis = false, bool isCascaded = false, object calledBy = null)
 {
     if (applicationrole == null || applicationrole.IsTransient())
     {
         return;
     }
     if (applicationrole.Users.Count > 0)
     {
         var cs = new System.Data.ConstraintException("applicationrole.Users elements are restricted and cannot be deleted");
         cs.Data["Entity"]       = "ApplicationRole";
         cs.Data["PropertyName"] = "Users";
         cs.Data["Multiplicity"] = "*";
         throw cs;
     }
     foreach (var toDissasociate in applicationrole.Permissions)
     {
         applicationrole.RemovePermissions(toDissasociate);
     }
     if (!doNotCallDeleteForThis)
     {
         Delete <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>(applicationrole, isCascaded);
     }
 }
コード例 #2
0
/// <summary>
///     Returns true if self and the provided entity have the same Id values
///     and the Ids are not of the default Id value
/// </summary>
        protected bool HasSameNonDefaultIdAs(ApplicationRole compareTo)
        {
            return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id));
        }