public void SetUnitRole(IRelationType relationType, object unit) { if (unit == null) { this.RemoveUnitRole(relationType); return; } this.AssertNotDeleted(); RoleAssertions.UnitRoleChecks(this, relationType.RoleType); unit = relationType.RoleType.Normalize(unit); this.session.SetUnitRole(this.objectId, relationType.RoleType, unit); }
public virtual void SetUnitRole(IRelationType relationType, object role) { this.AssertExist(); RoleAssertions.UnitRoleChecks(this, relationType.RoleType); if (role != null) { role = relationType.RoleType.Normalize(role); } var oldUnit = this.GetUnitRole(relationType); if (!Equals(oldUnit, role)) { this.Roles.SetUnitRole(relationType.RoleType, role); } }