public static void TryAction <T>(Action action, out BrokenRules rulesBroken) { rulesBroken = None; using (new Check.DisableDotNetAssertsScope()) { try { action(); } catch (PreconditionException ex) { rulesBroken = From(ex.InnerExceptions, typeof(T)); } catch (BrokenRulesException ex) { rulesBroken = ex.BrokenRules; } } }
public static T TryCreateObject <T>(Func <T> creator, out BrokenRules rulesBroken) { rulesBroken = None; using (new Check.DisableDotNetAssertsScope()) { try { return(creator()); } catch (PreconditionException ex) { rulesBroken = From(ex.InnerExceptions, typeof(T)); } catch (BrokenRulesException ex) { rulesBroken = ex.BrokenRules; } return(default(T)); } }
private BrokenRulesException(SerializationInfo info, StreamingContext context) : base(info, context) { // Because this class is sealed, this constructor is private. // if this class is not sealed, this constructor should be protected. _brokenRules = info.GetValue("BrokenRules", typeof(BrokenRules)) as BrokenRules; }
public BrokenRulesException(string message, BrokenRules brokenRules, Exception innerException) : base(message, innerException) { _brokenRules = brokenRules; }
public BrokenRulesException(string message, BrokenRules brokenRules) : base(message) { _brokenRules = brokenRules; }
/// <seealso cref="Map{T}(System.Collections.Generic.IEnumerable{BrokenRule},OneToManyObjectToObjectMap{T})"/> public BrokenRules Map <TDest>(BrokenRules brokenRules, OneToManyObjectToObjectMap <TDest> mappings) { return(new BrokenRules(Map(brokenRules.AsEnumerable(), mappings))); }