BHoM / BHoM/BHoM_Engine

Data_Engine: add a Convert.Request method as a temporary fix for incorrectly used FilterRequest

Open
#1,261 0 comments 0 reactions 1 assignee Claimed by @alelom View on GitHub
type:feature
Dominant language
C#
Stars
30
Forks
13
Avg merge
7d 10h
Merged PRs (30d)
5

Description

#### Description of the need:

Linked to the addition of more appropriate Requests (https://github.com/BHoM/BHoM/issues/571).

We need a way of transitioning between the improper ubiquitous usage of `FilterRequest` and more appropriate implementations of `IRequest`.

The transition means that we need to change the Adapter `Read()` method to accept the more generic `IRequest` instead of `FilterRequest`, and to simplify the logic in the both `Pull` and all `Read`, `ReadResults` etc. methods so that they don't only work for `FilterRequest`s.

However, such a change will require many Toolkits to align, and it will need some time (variable and hard to plan with precision) to implement their own IRequests instead of FilterRequests.

### Proposal

In order to make the Adapter Refactoring easier, the proposal is to have an Engine method that converts the old implementations of FilterRequest into the newly defined IRequests as soon as they have been defined (https://github.com/BHoM/BHoM/issues/571).

For example, the FilterRequest that now is used to query the Results uses the `Equalities` properties to store info, which is incorrect (as [IEquality should be removed from IRequest](https://github.com/BHoM/BHoM/issues/546), and the corresponding logic is incorrectly placed in the Pull:

https://github.com/BHoM/BHoM_Adapter/blob/c62c11f34b6b8ba365ead1d61bcf64078a371b21/BHoM_Adapter/BHoMAdapter.cs#L108-L138

That logic should be moved in this convert method in the Engine. Such method should that take as input any FilterRequest, determine what type of new IRequest it should be, and convert it into that.

A call to this method should then be placed into the Adapter Pull and Read methods.

In the long term, this conversion will instead happen in the respective Toolkits.
When the transition from the old implementations of FilterRequest to the new IRequest is completed, this Engine.Convert method will then removed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.