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

Further cleanup/improvements #269

Merged
merged 8 commits into from
Jul 10, 2024
Merged

Conversation

adschmu
Copy link
Contributor

@adschmu adschmu commented Jul 10, 2024

This is based on the changes in #268

If you want both, just take this PR.

adschmu added 8 commits July 10, 2024 09:27
This enables nullable annotations in the projects and adjust all types accordingly.

There are no warnings left, everything should be good to go.
This enables nullable annotations in the projects and adjusts all types
accordingly. There are three unresolved warnings due to properties that are
assigned to non-nullable values when assigned, but have no default value.

This can be resolved by the "required" member attribute, but this is only
available with C# 11 (.NET 7). Keep the warnings for now.

Note that the Nullable definition is moved to Directory.Build.props now, since
we have it enabled in all core projects now.
Use "Get" and "replace" which are the defaults for unobtrusive ajax here as well.

This removes the nullable warning for HttpMethod.
Not really much to do here either.

While at it, use explicit types on some int variables.
  * Use more specific Assert methods

  * Use "void" return type where no async/await is used

  * Remove unused local variables
This has an async-over-sync implementation, but no native sync one. Add it.
At the moment, Extensions like ToPagedList and ToPagedListAsync are defined
in the same namespace as all the other types. This poses a few problems:

  * If one wants to use X.PagedList.EF, he will have name collisions between
    the EF version of ToPagedListAsync and the default async-over-sync version.
    While this can be resolved by choosing the X.PagedList.EF namespace in a
    "using", using any of the base types like IPagedList would still require
    to add the X.PagedList "using" again or use a full qualifier.

  * If somebody only wants the base types like IPagedList, but desires to
    implement Extensions on his own, he will draw back in the upstream
    Extensions by a "using" statement.

  * If somebody wants to hide the async-over-sync implementations from
    inexperienced developers, but needs the rest of the package, there is no
    option so far.

All of this can be resolved by putting the different Extensions in their
dedicated namespaces. This way one can choose whether he only wants the base
classes and interfaces or whether different types of Extensions are desired.
Choosing between them is as simple as putting the appropriate "using" on top
of the file. This allows to switch between the EF and async-over-sync
implementations as it does allow to disable some of them.

The new namespaces are:

  X.PagedList.Extensions        The sync implementations

  X.PagedList.AsyncExtensions   The fake async (async-over-sync) implementations

  X.PagedList.EF                The proper async EF Core implementations
                                (this namespace is unchanged)

This will require users of earlier package versions to add them too, of course,
but this is trivial.
@adschmu
Copy link
Contributor Author

adschmu commented Jul 10, 2024

If you also want #262 , just take #262 and close #268 and #269

@a-gubskiy a-gubskiy merged commit 245e3e1 into dncuug:master Jul 10, 2024
1 check passed
@adschmu adschmu deleted the pr/further-cleanup branch July 10, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants