/// <summary> /// Cheks the Rules Violations on the given <see cref="IModelEntity"/>. If rules violations exist, /// a <see cref="RulesViolationsException"/> is thrown. /// </summary> /// <param name="modelEntity">The model entity.</param> /// <exception cref="RulesViolationsException"> /// Thrown if rules violations exist. /// </exception> public static void CheckRulesViolations(this IModelEntity modelEntity) { if (!modelEntity.IsValid()) { throw new RulesViolationsException("Rule violations prevent saving", modelEntity.GetRuleViolations()); } }