diff --git a/DigitalData.Core.Abstractions/ConfigurationExtension.cs b/DigitalData.Core.Abstractions/ConfigurationExtension.cs
index 5515124..175cf0c 100644
--- a/DigitalData.Core.Abstractions/ConfigurationExtension.cs
+++ b/DigitalData.Core.Abstractions/ConfigurationExtension.cs
@@ -1,30 +1,29 @@
using Microsoft.Extensions.Configuration;
-namespace DigitalData.Core.Abstractions
+namespace DigitalData.Core.Abstractions;
+
+///
+/// Extension methods for the interface, providing
+/// additional functionality for retrieving configuration values with default behavior.
+///
+public static class ConfigurationExtension
{
///
- /// Extension methods for the interface, providing
- /// additional functionality for retrieving configuration values with default behavior.
+ /// Retrieves a configuration value for the specified key, or returns a default value
+ /// of type if the configuration is not found or the key is null.
///
- public static class ConfigurationExtension
- {
- ///
- /// Retrieves a configuration value for the specified key, or returns a default value
- /// of type if the configuration is not found or the key is null.
- ///
- /// The type of the object to retrieve from the configuration.
- /// The instance.
- /// The optional key to look for in the configuration. If null, the method
- /// retrieves the root configuration.
- ///
- /// An instance of populated from the configuration values, or
- /// a new instance of if no matching configuration is found.
- ///
- public static T GetOrDefault(this IConfiguration configuration, string? key = null)
- where T : new()
- => (key is null
- ? configuration.Get()
- : configuration.GetSection(key).Get())
- ?? new T();
- }
+ /// The type of the object to retrieve from the configuration.
+ /// The instance.
+ /// The optional key to look for in the configuration. If null, the method
+ /// retrieves the root configuration.
+ ///
+ /// An instance of populated from the configuration values, or
+ /// a new instance of if no matching configuration is found.
+ ///
+ public static T GetOrDefault(this IConfiguration configuration, string? key = null)
+ where T : new()
+ => (key is null
+ ? configuration.Get()
+ : configuration.GetSection(key).Get())
+ ?? new T();
}
diff --git a/DigitalData.Core.Application/Interfaces/Repository/IReadQuery.cs b/DigitalData.Core.Application/Interfaces/Repository/IReadQuery.cs
new file mode 100644
index 0000000..e3ace52
--- /dev/null
+++ b/DigitalData.Core.Application/Interfaces/Repository/IReadQuery.cs
@@ -0,0 +1,80 @@
+using System.Linq.Expressions;
+
+namespace DigitalData.Core.Application.Interfaces.Repository;
+
+///
+/// Provides methods for executing common queries on a given entity type.
+/// This interface abstracts away the direct usage of ORM libraries (such as Entity Framework) for querying data
+/// and provides asynchronous and synchronous operations for querying a collection or single entity.
+///
+/// The type of the entity being queried.
+public interface IReadQuery
+{
+ ///
+ /// Adds a filter to the query using the specified predicate expression.
+ /// This method allows chaining multiple filter conditions to refine the query results.
+ ///
+ /// An expression that defines the filter condition for the entity.
+ /// The current instance with the applied filter.
+ public IReadQuery Where(Expression> expression);
+
+ ///
+ /// Asynchronously retrieves the first entity or a default value if no entity is found.
+ ///
+ /// A task that represents the asynchronous operation. The task result contains the entity or a default value.
+ public Task FirstOrDefaultAsync();
+
+ ///
+ /// Asynchronously retrieves a single entity or a default value if no entity is found.
+ ///
+ /// A task that represents the asynchronous operation. The task result contains the entity or a default value.
+ public Task SingleOrDefaultAsync();
+
+ ///
+ /// Asynchronously retrieves a list of entities.
+ ///
+ /// A task that represents the asynchronous operation. The task result contains the list of entities.
+ public Task> ToListAsync();
+
+ ///
+ /// Asynchronously retrieves the first entity. Throws an exception if no entity is found.
+ ///
+ /// A task that represents the asynchronous operation. The task result contains the first entity.
+ public Task FirstAsync();
+
+ ///
+ /// Asynchronously retrieves a single entity. Throws an exception if no entity is found.
+ ///
+ /// A task that represents the asynchronous operation. The task result contains the single entity.
+ public Task SingleAsync();
+
+ ///
+ /// Synchronously retrieves the first entity or a default value if no entity is found.
+ ///
+ /// The first entity or a default value.
+ public TEntity? FirstOrDefault();
+
+ ///
+ /// Synchronously retrieves a single entity or a default value if no entity is found.
+ ///
+ /// The single entity or a default value.
+ public TEntity? SingleOrDefault();
+
+ ///
+ /// Synchronously retrieves a list of entities.
+ ///
+ /// The list of entities.
+ public IEnumerable ToList();
+
+ ///
+ /// Synchronously retrieves the first entity. Throws an exception if no entity is found.
+ ///
+ /// The first entity.
+ public TEntity First();
+
+ ///
+ /// Synchronously retrieves a single entity. Throws an exception if no entity is found.
+ ///
+ /// The single entity.
+ public TEntity Single();
+}
\ No newline at end of file