/// <inheritdoc cref="ISupportSynchronousCommandValidation{T}.Validate"/> /// <exception cref="System.InvalidCastException">Thrown when supplied command does not implement <see cref="ISupportSynchronousCommandValidation{T}"/>.</exception> public static ISynchronousCommandValidationResult <T> Validate <T>(this ISynchronousCommand <T> command) { var validationSupporter = command as ISupportSynchronousCommandValidation <T>; if (validationSupporter == null) { throw new InvalidCastException($"Supplied command does not implement {nameof(ISupportSynchronousCommandValidation<T>)} interface."); } var validationResult = validationSupporter.Validate(); return(validationResult); }
/// <inheritdoc cref="ISynchronousRulesContainer.GetRules"/> /// <exception cref="System.InvalidCastException">Thrown when supplied command does not implement <see cref="ISynchronousRulesContainer"/>.</exception> public static IEnumerable <ISynchronousRule> GetRules <T>(this ISynchronousCommand <T> command) { return(GetRules(command as ISynchronousRulesContainer)); }