-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Open
Copy link
Description
This could be handy to allow querying by those columns in particular.
So maybe it could be via an implemented interface that's then used when creating the repository? For example: DocumentRepository.Create<Book, IAddressable>()?
public static IDocumentRepository<T> Create<T, TProperties>(...)
where T: class, TProperties
where TProperties: IDocumentEntityWhere the returned document repository augmented IDocumentRepository<T> with the ability to perform queries, such as:
public interface IDocumentRepository<T, TProperties> : IDocumentRepository<T>
where T : class, TProperties
{
IAsyncEnumerable<T> CreateQuery(Expression<Func<TProperties, bool>> predicate, CancellationToken cancellation = default);
}Note that unlike table repository IQueryable<T> CreateQuery() version, we need to restrict the available properties for querying to the TProperties since not all T properties will be available as columns. So using an expression for the properties and an async enumerable with the full entity type seems the most natural.
Metadata
Metadata
Assignees
Labels
No labels
