-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60901c9
commit 10d2421
Showing
9 changed files
with
130 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
10d2421
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QueryTokenString<T>
: Against the last stringly-typed strongholdWhen creating
SearchControls
,ValueSearchControls
or anyting that requires aFindOptions
we usually need to write QueryTokens. Till today they where error-prone strings like"Entity.Category"
.This commit provides a new type-safe approach.
QueryTokenString<T>
, providing a fluent API to generate query token strings.This is the API for now:
And Type has a convinced methods to get one instance:
How To use it
instead of writing:
Now you write:
There are many more examples here: signumsoftware/extensions@e010e76
Limitations
The QueryToken API is not a 1-to-1 mapping to C# or Typescript, making this API not as straightforward as it could be. This differences are there to simplify the UI to the end user.
QueryTokenString
will automatically make it uppercase.!
here an there. They will be removed in javascript and also in the QueryToken.expression(string)
method..implicit(a=>a.entity!)
How to upgrade:
Then you'll need to manually change
MyEntity
for the entity related to thequeryName
and fix the lambda ([Ctrl]+[Space]).In some cases where
queryName
is dynamic you can use the static methods inQueryTokenString
likeQueryTokenString.entity()
Enjoy a type-safe world 👍 👮 🎈
10d2421
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!