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); } }