Dreamescaper / ServiceScan.SourceGenerator

Assembly scanning source generator for Microsoft.Extensions.DependencyInjection
MIT License
14 stars 1 forks source link

Improve AsSelf code generation #10

Closed latop2604 closed 1 day ago

latop2604 commented 1 week ago

When using AsSelf = true, it generates something like service.AddTransient<MyNamespace.MyClass,MyNamespace.MyClass>().

It would be nice if it could produce instead service.AddTransient<MyNamespace.MyClass>()

Dreamescaper commented 1 week ago

Does it make any difference?

latop2604 commented 1 week ago

For readability, I would say yes, otherwise, no.

latop2604 commented 1 week ago

I think it would better match with what a dev would have written by hand. But maybe I'm wrong.

I know it can be a subjective question.

I can do a PR if you want

Dreamescaper commented 1 day ago

While it is nice to have a readable generated source, it's probably not the main goal. There are lots of things which developer would've done differently - having namespaces usings instead of full type names, for instance. At this point, I would prefer to keep the code simplier over having this minor readability improvement. Especially considering this item - #4 .

Still, thanks a lot for the suggestion and feedback!