Exemple #1
0
        /// <summary>
        /// Enable SQL attachments for this endpoint.
        /// </summary>
        public static AttachmentSettings EnableAttachments(
            this EndpointConfiguration configuration,
            string connection,
            GetTimeToKeep timeToKeep)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(timeToKeep, nameof(timeToKeep));
            Guard.AgainstNullOrEmpty(connection, nameof(connection));
            var settings    = configuration.GetSettings();
            var attachments = new AttachmentSettings(() => OpenConnection(connection), timeToKeep);

            return(SetAttachments(configuration, settings, attachments));
        }
Exemple #2
0
        /// <summary>
        /// Enable SQL attachments for this endpoint.
        /// </summary>
        public static AttachmentSettings EnableAttachments(
            this EndpointConfiguration configuration,
            Func <Task <SqlConnection> > connectionFactory,
            GetTimeToKeep timeToKeep)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(timeToKeep, nameof(timeToKeep));
            Guard.AgainstNull(connectionFactory, nameof(connectionFactory));
            var settings    = configuration.GetSettings();
            var attachments = new AttachmentSettings(connectionFactory, timeToKeep);

            return(SetAttachments(configuration, settings, attachments));
        }
Exemple #3
0
        /// <summary>
        /// Enable SQL attachments for this endpoint.
        /// </summary>
        public static AttachmentSettings EnableAttachments(
            this EndpointConfiguration configuration,
            string fileShare,
            GetTimeToKeep timeToKeep)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(timeToKeep, nameof(timeToKeep));
            Guard.AgainstNullOrEmpty(fileShare, nameof(fileShare));
            var settings    = configuration.GetSettings();
            var attachments = new AttachmentSettings(fileShare, timeToKeep);

            settings.Set(attachments);
            configuration.EnableFeature <AttachmentFeature>();
            configuration.DisableFeature <AttachmentsUsedWhenNotEnabledFeature>();
            return(attachments);
        }
Exemple #4
0
        /// <summary>
        /// Enable SQL attachments for this endpoint.
        /// </summary>
        public static AttachmentSettings EnableAttachments(
            this EndpointConfiguration configuration,
            Func <Task <SqlConnection> > connectionFactory,
            GetTimeToKeep timeToKeep)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(timeToKeep, nameof(timeToKeep));
            Guard.AgainstNull(connectionFactory, nameof(connectionFactory));
            var settings    = configuration.GetSettings();
            var attachments = new AttachmentSettings(connectionFactory, timeToKeep);

            settings.Set <AttachmentSettings>(attachments);
            configuration.EnableFeature <AttachmentFeature>();
            configuration.DisableFeature <AttachmentsUsedWhenNotEnabledFeature>();
            return(attachments);
        }
Exemple #5
0
 static AttachmentSettings SetAttachments(EndpointConfiguration configuration, SettingsHolder settings, AttachmentSettings attachments)
 {
     settings.Set(attachments);
     configuration.EnableFeature <AttachmentFeature>();
     configuration.DisableFeature <AttachmentsUsedWhenNotEnabledFeature>();
     return(attachments);
 }