public async Task SendAsync <TSubject, TBody>(IEmail <TSubject, TBody> email) where TSubject : IEmailSubject where TBody : IEmailBody { if (email == null) { throw new ArgumentNullException(nameof(email)); } EmailBouncer .Validate((IEmail <IEmailSubject, IEmailBody>)email) .ThrowIfInvalid(); try { await SendAsyncCore(email); } catch (Exception innerException) { throw DynamicException.Factory.CreateDynamicException( $"SendEmail{nameof(Exception)}", $"Could not send email: Subject = '{email.Subject}' To = '{email.To}' From = '{email.From}'.", innerException ); } }
public ILoggerFactory Build() { SelfBouncer.Validate(this); return(new LoggerFactory { Observers = _rxes, Configuration = new LoggerFactoryConfiguration { Attachements = { new OmniLog.Attachements.Lambda("Environment", _ => _environment), new OmniLog.Attachements.Lambda("Product", _ => _product), new OmniLog.Attachements.Timestamp <DateTimeUtc>(), new OmniLog.Attachements.Scope(new JsonSerializer { Settings = _scopeSerializerSettings }), new OmniLog.Attachements.ElapsedMilliseconds("Elapsed"), new OmniLog.SemanticExtensions.Attachements.Snapshot(new JsonSerializer { Settings = _snapshotSerializerSettings }) } } }); }
public static BouncerPolicyCheckLookup <T> ValidateWith <T>([NotNull] this T value, [NotNull] IBouncer <T> bouncer) => bouncer.Validate(value);