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

Refactor & Code-Cleaning #19

Merged
merged 14 commits into from
Jan 13, 2021
Merged

Refactor & Code-Cleaning #19

merged 14 commits into from
Jan 13, 2021

Conversation

enisn
Copy link
Owner

@enisn enisn commented Dec 22, 2020

Summary

This PR includes no new feature. This is PR includes HUGE CORE CHANGES. As simple; these improvements that makes library more extensible & refactoring-easy. By the way, some of bug fixes are included in this PR.

  • Made virtual most of members of AutoFilterer.Types
  • Performance improvements at FilterBase.BuildExpression() (about 1~3 ns. 😂)
  • Typo fixes at documenting & comments.
  • Moved Combine logic to ExpressionExtensions
  • Remove Obsolete features (such as generic filterBases)
  • [ ] Chaining attributes (Markup Goals #18 ) (v3)
  • [ ] Nested support for CompareToAttribute (Nested Queries don't work with CompareToAttribute #17 ) (v3)

Migration guide to v2.6

Follow this document step by step if you're migration from v2.5.x to v2.6.x, if you're on older version, let's follow old migrations before this documentation:

1 - First step is 'Don't worry!' Just update your AutoFilterer nuget packages.

2 - Fix namespaces

AutoFilterer v2.6 comes with namespace changes. AutoFilterer.Enums changed as AutoFilterer.

  • Open your project in your IDE
  • Press CTRL + H ( or CMD + H for Mac users.)
  • Type using AutoFilterer.Enums; for first box and using AutoFilterer; for second box.
  • Choose Entire Project or Entire Solution if you're using in multiple assembly.
  • Then execute it.

If some of files have duplicated using AutoFilterer line, you'll get warnings at compile-time. You can use resharper or similar tools to fix it.

3 - Remove obsolete FilterBases
Only if you've PaginationFilterBase<T> type which is marked as obsolete before. You need to say good bye to it.

  • Try to compile your project.
    • If you don't get error, congratulations 🎉 you don't have an obsolete type. Just skip step 3.
  • Replace PaginationFilterBase<T> with PaginationFilterBase. All behaviors are same! Check Step 1 and Dont' worry!
- public class BookFilter : PaginationFilterBase<Book>
+ public class BookFilter : PaginationFilterBase
{
  // ...
}

4 - Remove CombineWith overrides
If you've overrided any of CombineWith() method, you shouldn't! Remove it and use Attribute Chaining feature.

public class MyRange<T> : Range<T> where T : struct, IComparable
{
-  public override Expression Combine(Expression left, PropertyInfo right)
-  {
-       // Some your custom logic...
-  }
}

@codefactor-io
Copy link

codefactor-io bot commented Dec 22, 2020

CodeFactor found an issue: A closing curly bracket must not be preceded by a blank line.

It's currently on:
src\AutoFilterer.Dynamics\DynamicFilter.cs:97
Commit e8c3d72

@enisn enisn marked this pull request as draft December 25, 2020 08:53
@enisn enisn self-assigned this Jan 13, 2021
Copy link
Owner Author

@enisn enisn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now can be merged without any breaking change

@enisn enisn marked this pull request as ready for review January 13, 2021 21:11
@enisn
Copy link
Owner Author

enisn commented Jan 13, 2021

Namespace changes are disabled for now.

@enisn enisn merged commit 3bbb428 into master Jan 13, 2021
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.

1 participant