-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMemberValidationManagerStatic.cs
35 lines (28 loc) · 1.3 KB
/
MemberValidationManagerStatic.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
namespace ValidationFramework
{
public partial class MemberValidationManager
{
/// <summary>
/// Should be called if no rules can be found.
/// </summary>
/// <param name="ruleSet">The rule set being validated.</param>
/// <param name="ruleFound"><see langword="true"/> if <see cref="Rule"/>s where found; otherwise <see langword="false"/>.</param>
/// <param name="throwException"><see langword="true"/> to throw an exception if the type is not found; <see langword="false"/> to ignore.</param>
/// <exception cref="InvalidOperationException"><paramref name="ruleFound"/> is <see langword="false"/> and <paramref name="throwException"/> is <see langword="true"/>.</exception>
public static void ThrowNoRules(string ruleSet, bool ruleFound, bool throwException)
{
if (!ruleFound && throwException)
{
if (ruleSet == null)
{
throw new InvalidOperationException("No members could be found containing rules.");
}
else
{
throw new InvalidOperationException(string.Format("No members could be found containing rules with the ruleSet '{0}'.", ruleSet));
}
}
}
}
}