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

Allow repository to edit where clause #79

Closed
wants to merge 2 commits into from
Closed

Allow repository to edit where clause #79

wants to merge 2 commits into from

Conversation

ThomasBleijendaal
Copy link
Contributor

When developing a custom repository, it is sometimes required to adjust the way the where clause is generated. This change creates 3 override-able methods to alter the way the where clause is generated.

Examples why the where clause should be configurable:

  • The default database access layer adds ToUpper to make where clauses case insensitive. This is not always the case when using a custom repository with, for example, Entity Framework.
  • The StartsWith is not always the best method for the fuzzy finder, so sometimes searching using Contains is the better option.

Furthermore, this PR removes the skipping of the Name column in the orderBy clause. DefaultFluidityRepository uses _collection.SortProperty as a fallback for sorting, but that is unavailable for custom repositories. By never skipping the name column, the orderBy clause always has a usable value.

@mattbrailsford
Copy link
Owner

Hi Thomas,

Thank for spending the time to submit this PR. I totally understand the use case but I think I just need to give some thought to the implementation as I'm not sure it would be totally clear to other implementors.

There is a discussion on issue #73 about supporting a configurable SearchBehaviour to have a means to switch to Contains over StartsWith which I think might be a better option for this element. The other elements I need to give a little thought to.

@ThomasBleijendaal
Copy link
Contributor Author

Hi,

I understand, but that is also why I implemented it as virtual methods. The generic, abstract FluidityRepository does not require the implementor to implement these methods themselves (unlike the *Impl methods), but when needed, can be overridden.

@mattbrailsford
Copy link
Owner

mattbrailsford commented Oct 31, 2018 via email

@nehanupur0507
Copy link

Is this change still happening??

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

Successfully merging this pull request may close these issues.

3 participants