Closed dzmitry-lahoda closed 2 years ago
Msbuild tasks and t4 are more far from compiler than source generators. The closes stuff to compiler the faster the more versatile and more brodly supported it becames. E.g.what if I want adding custom limits on ctor of values like being 15 bit size? Or use generator from projectless flow? I bet source generators are target of being best at these.
I disagree, from the point of view of the library, I can't find any significant difference in implementation from using CodeGeneration.Roslyn vs source generators. Frankly, the tooling support is worse with source generators at the moment too.
The custom constructor arguments is an interesting request, but not one that is related to source generators. The projectless target may be a limitation, I don't know to be honest.
A far more interesting feature in c#9 is records, as these make the library obsolete. That's all the strongly typed IDs are really records, and you get that for free in c#9!
@andrewlock great work; you also mention that C# 9.0 record types would be a better option in your blog; any plans to show how/what the record type brings to the table and do a comparison
Hi @3GDXC, yes I plan to look at this, bit haven't got round to it yet!
I've released a beta version of a major update to the library that converts to using Source generators. There's quite a few breaking changes in the release, so please make sure to check the release notes for how to update, but I'd appreciate any feedback you have before I do a final release!
I've also written a blog post announcing the update that goes into a bit more details: https://andrewlock.net/rebuilding-stongly-typed-id-as-a-source-generator-1-0-0-beta-release
Thanks! 🙂
Closing this now as I've merged the source generators spike
I've done some experimenting with this, and I don't think source generators really give us that much 🤷♂️