diff --git a/DigitalData.Core.Application/DigitalData.Core.Application.csproj b/DigitalData.Core.Application/DigitalData.Core.Application.csproj
index ef70af7..c6d0754 100644
--- a/DigitalData.Core.Application/DigitalData.Core.Application.csproj
+++ b/DigitalData.Core.Application/DigitalData.Core.Application.csproj
@@ -14,9 +14,9 @@
core_icon.png
http://git.dd:3000/AppStd/WebCoreModules.git
digital data core application clean architecture
- 3.0.1
- 3.0.1
- 3.0.1
+ 3.1.0
+ 3.1.0
+ 3.1.0
diff --git a/DigitalData.Core.Application/DirectorySearchOptions.cs b/DigitalData.Core.Application/DirectorySearchOptions.cs
index 97306d1..eebed94 100644
--- a/DigitalData.Core.Application/DirectorySearchOptions.cs
+++ b/DigitalData.Core.Application/DirectorySearchOptions.cs
@@ -5,21 +5,24 @@
///
public class DirectorySearchOptions
{
+ //TODO: Merge with Root and rename as path
///
/// Gets or initializes the name of the server to be used in the directory search.
///
- public string? ServerName { get; init; }
+ public required string ServerName { get; init; }
///
/// Gets or initializes the root directory path for the search.
///
- public string? Root { get; init; }
+ public required string Root { get; init; }
+ //TODO: Convert to timespan
///
/// Gets or initializes the number of days before the user cache expires.
///
- public int UserCacheExpirationDays { get; init; }
+ public double? UserCacheExpirationDays { get; init; }
+ //TODO: Rename as CustomSearchFilters
///
/// Gets or initializes the custom search filters to be applied during directory searches.
///
diff --git a/DigitalData.Core.Application/DirectorySearchService.cs b/DigitalData.Core.Application/DirectorySearchService.cs
index 188cdfa..16b714c 100644
--- a/DigitalData.Core.Application/DirectorySearchService.cs
+++ b/DigitalData.Core.Application/DirectorySearchService.cs
@@ -15,7 +15,7 @@ namespace DigitalData.Core.Application
public string ServerName { get; }
public string Root { get; }
public string SearchRootPath { get; }
- private readonly DateTimeOffset _userCacheExpiration;
+ private readonly DateTimeOffset? _userCacheExpiration;
public Dictionary CustomSearchFilters { get; }
///
@@ -32,19 +32,16 @@ namespace DigitalData.Core.Application
var dirSearchOptions = options.Value;
- ServerName = dirSearchOptions.ServerName ?? throw new InvalidOperationException("The server name for directory search is not configured. Please specify the 'DirectorySearch:ServerName' in the configuration.");
+ ServerName = dirSearchOptions.ServerName;
- Root = dirSearchOptions.Root ?? throw new InvalidOperationException("The root for directory search is not configured. Please specify the 'DirectorySearch:Root' in the configuration.");
+ Root = dirSearchOptions.Root;
SearchRootPath = $"LDAP://{ServerName}/{Root}";
CustomSearchFilters = dirSearchOptions.CustomSearchFilters;
- var dayCounts = dirSearchOptions.UserCacheExpirationDays;
- if (dayCounts == default)
- _userCacheExpiration = default;
- else
- _userCacheExpiration = DateTimeOffset.Now.Date.AddDays(dayCounts);
+ if(dirSearchOptions.UserCacheExpirationDays is double expirationDays)
+ _userCacheExpiration = DateTimeOffset.Now.Date.AddDays(expirationDays);
}
///
@@ -123,13 +120,12 @@ namespace DigitalData.Core.Application
/// The directory entry password.
public void SetSearchRootCache(string dirEntryUsername, string dirEntryPassword)
{
- if (_userCacheExpiration == default)
- _memoryCache.Set(key: dirEntryUsername, new DirectoryEntry(path: SearchRootPath, username: dirEntryUsername, password: dirEntryPassword));
+ if (_userCacheExpiration is DateTimeOffset cacheExpiration)
+ _memoryCache.Set(key: dirEntryUsername, new DirectoryEntry(path: SearchRootPath, username: dirEntryUsername, password: dirEntryPassword), absoluteExpiration: cacheExpiration);
else
- _memoryCache.Set(key: dirEntryUsername, new DirectoryEntry(path: SearchRootPath, username: dirEntryUsername, password: dirEntryPassword), absoluteExpiration: _userCacheExpiration);
+ _memoryCache.Set(key: dirEntryUsername, new DirectoryEntry(path: SearchRootPath, username: dirEntryUsername, password: dirEntryPassword));
}
-
///
/// Gets the search root from the cache.
///
diff --git a/DigitalData.Core.Application/obj/Release/net7.0/DigitalD.553292A0.Up2Date b/DigitalData.Core.Application/obj/Release/net7.0/DigitalD.553292A0.Up2Date
deleted file mode 100644
index e69de29..0000000