ardalis / Specification

Base class with tests for adding specifications to a DDD model
MIT License
1.83k stars 238 forks source link

Implementing additional provider for Azure Storage Tables #381

Open rgn opened 5 months ago

rgn commented 5 months ago

Hi there,

I really like the approach via specification and thinking if it is possible to create a provider for Azure Storage Tables. My first guess was to align to the EFCore implementation, but indeed Storage Tables to not provide IQueryable to push the queries down to the data layer.

Obviously, it's not feasible to transfer the whole table content to create an IQueryable over the retrieved data.

So my questions are:

fiseni commented 5 months ago

Hi @rgn,

The specification state is held in the form of expressions (not as IQueryable). Then the provider packages translate the state to a required form; in the case of EF, we apply the state on top of the DbSets.

So, if you can write queries for Azure Storage Tables using expressions, then we can create a provider for it. I haven't used the Azure Tables extensively yet. Can you provide some info what is the most common usage? What is the standard set of operations used in the applications? How do you query? How do you save data?

I see in the docs about the Azure Tables client library that you usually use expressions to build the queries. Is this the standard?

double priceCutOff = 6.00;
Pageable<OfficeSupplyEntity> queryResultsLINQ = tableClient.Query<OfficeSupplyEntity>(ent => ent.Price >= priceCutOff);