GithubHelp home page GithubHelp logo

Comments (8)

sleeuwen avatar sleeuwen commented on July 22, 2024 1

Hi @TorreyGarland,

Sounds like a good idea to add the ability to ignore specific types for the generated methods. In fact, I'm already ignoring some types like IFormFile. To exclude custom types, I think adding an assembly attribute would be the easiest way to do it. Would something like this for you? in that case any parameters of the type GridParameters will not be included in the generated method.

[assembly: UrlActionGenerator.ExcludeUrlParameterType(typeof(GridParameters))]

I'll probably add CancellationToken as a default excluded parameter type as well.

Regarding the performance, the source generator is invoked a lot while editing so even if it only takes a few more milliseconds it can degrade the experience a lot. The integration of source generators and razor pages is currently non-existent (as far as I know) so for that I have to resort to file system reads, together with the fact it is invoked a lot it can become very slow. Having a quick look at the new razor source generator for .NET 6 it looks like they are using a new incremental generator, that could help improve this in the future but I haven't seen any documentation about the changes in .NET 6 for this. I will keep an eye on this and update the generator to use the new features when possible.
For now, I'll try to see if I can reduce the time it takes for the source generator to complete.

from urlactiongenerator.

sleeuwen avatar sleeuwen commented on July 22, 2024 1

@JoaoFCorreia I have just released a new version to nuget, 0.6.0, which now ignores CancellationToken parameters by default.

@TorreyGarland This release also enabled you to specify types that should not be generated as parameters by using an assembly attribute like this:

[assembly: UrlActionGenerator.ExcludedParameterType(typeof(MyCustomTypeThatShouldBeExcluded))]

from urlactiongenerator.

TorreyGarland avatar TorreyGarland commented on July 22, 2024

Thanks for looking into this!

from urlactiongenerator.

JoaoFCorreia avatar JoaoFCorreia commented on July 22, 2024

Hi @TorreyGarland the feature for ignoring parameters of type CancellationToken is still being planned?

from urlactiongenerator.

sleeuwen avatar sleeuwen commented on July 22, 2024

Hi @JoaoFCorreia I have actually implemented most of the changes to support ignoring custom types (and added CancellationToken as ignored by default). I will try to finish it either this week or next week and release a new version with the change.

from urlactiongenerator.

TorreyGarland avatar TorreyGarland commented on July 22, 2024

have you considered using an IIncrementalGenerator and blazor capable?

from urlactiongenerator.

sleeuwen avatar sleeuwen commented on July 22, 2024

Hi @TorreyGarland yes I have looked at the IIncrementalGenerator and it is actually already released in version 0.5.0. I haven't looked into support for blazor yet

from urlactiongenerator.

TorreyGarland avatar TorreyGarland commented on July 22, 2024

Thanks again.

from urlactiongenerator.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.