Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature : Alias Map #58

Closed
pksorensen opened this issue Dec 9, 2021 · 4 comments · Fixed by #76
Closed

Feature : Alias Map #58

pksorensen opened this issue Dec 9, 2021 · 4 comments · Fixed by #76
Assignees
Labels

Comments

@pksorensen
Copy link
Member

We based alot of functions of Power Automate, which makes sense. But generally writing my expressions i write eq() as a shorthand for equal.

Would properly be good to be able to just rename or alias functions in a project without having to implement it again.

I suggest we implement a service that can registered to map one function name to another.

@thygesteffensen
Copy link
Member

Good idea 💡 and not against, we just have to keep it true with Power Automate, since it is the core base - but we should still allow other use cases to be easy.

This could be combined with #47 to replace the current way functions are registered and 'retrieved', added a metadata class with shorthands, i.e. eq => equal, could be a good solution.

The use of shorthands should be controlled as an option, so it can be disregarded, and an error can be thrown, if ExpressionEngine is being used to test Power Automate flows.

I don't think we should bloat the current way functions are registered and retrieved, but instead recreate it properly :D

@pksorensen
Copy link
Member Author

pksorensen commented Dec 10, 2021

We agree,

i am thinking

var services = new ServiceCollection();
services.addExpressionEngine();

services.AddFunctionMap<MyFunctionMap>();

----

class MyFunctionMap : IFunctionMapper
{

       public string ResolveFunctionName(string name){
                  //logic to map names
       }

}

class DefaultFunctionMap : IFunctionMapper
{
 public string ResolveFunctionName(string name) => name;
}

Would be a none breaking feature but provide a way to do it.

thygesteffensen added a commit that referenced this issue Feb 28, 2022
FunctionMetadata.cs have been added to make it easier to add function aliases and make the function part lighter.
Added FunctionMetadata.cs makes it possible to register a function on multiple aliases. Furthermore, only the FunctionMetadata class is retrieved as a list from DI, thus not building the function before it is actually needed, making room for more heavy dependencies, without making the entire engine slow.

Resolved #47, Resolved #58. Still need to clean up.
@thygesteffensen thygesteffensen linked a pull request Feb 28, 2022 that will close this issue
@github-actions
Copy link

🎉 This issue has been resolved in version 4.0.0-dev.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@pksorensen pksorensen moved this to Todo in EAVFW Mar 30, 2022
@pksorensen pksorensen added this to EAVFW Mar 30, 2022
Repository owner moved this from Todo to Done in EAVFW May 25, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants