Skip to content

Commit

Permalink
Make EnableAttachments timeToKeep optional (#642)
Browse files Browse the repository at this point in the history
* Make EnableAttachments timeToKeep optional

* Update FileShareAttachmentsExtensions.cs
  • Loading branch information
SimonCropp authored Nov 4, 2024
1 parent 7613807 commit 8a52dae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Attachments.FileShare/FileShareAttachmentsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ public static class FileShareAttachmentsExtensions
public static AttachmentSettings EnableAttachments(
this EndpointConfiguration configuration,
string fileShare,
GetTimeToKeep timeToKeep)
GetTimeToKeep? timeToKeep = null)
{
Guard.AgainstNullOrEmpty(fileShare);
var settings = configuration.GetSettings();
var attachments = new AttachmentSettings(fileShare, timeToKeep);
var attachments = new AttachmentSettings(fileShare, timeToKeep ?? TimeToKeep.Default);
settings.Set(attachments);
configuration.EnableFeature<AttachmentFeature>();
configuration.DisableFeature<AttachmentsUsedWhenNotEnabledFeature>();
Expand Down
6 changes: 3 additions & 3 deletions src/Attachments.Sql/SqlAttachmentsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class SqlAttachmentsExtensions
public static AttachmentSettings EnableAttachments(
this EndpointConfiguration configuration,
Func<SqlConnection> connectionFactory,
GetTimeToKeep timeToKeep)
GetTimeToKeep? timeToKeep = null)
{
var dbConnection = connectionFactory();
if (dbConnection.State == ConnectionState.Open)
Expand Down Expand Up @@ -49,10 +49,10 @@ public static AttachmentSettings EnableAttachments(
public static AttachmentSettings EnableAttachments(
this EndpointConfiguration configuration,
Func<Cancel, Task<SqlConnection>> connectionFactory,
GetTimeToKeep timeToKeep)
GetTimeToKeep? timeToKeep = null)
{
var settings = configuration.GetSettings();
var attachments = new AttachmentSettings(connectionFactory, timeToKeep);
var attachments = new AttachmentSettings(connectionFactory, timeToKeep ?? TimeToKeep.Default);
return SetAttachments(configuration, settings, attachments);
}

Expand Down

0 comments on commit 8a52dae

Please sign in to comment.