devlooped / devlooped/TableStorage

When using document-based storage, allow projecting certain properties to columns

Open
#354 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
27
Forks
1
PR merge metrics
No merged PRs in 30d

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: IDocumentEntity

Where 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.

Back this issue
Back this issue

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the document repository creation API and the table repository CreateQuery implementation mentioned in the issue. Compare how repository capabilities are exposed, then determine how projected properties and the proposed constrained async query would fit. Done means the design is settled and document storage supports querying the selected properties as columns.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.