Closed matthewblott closed 2 years ago
Sorry for the delay, this one slipped past me!
Just to clarify, you say this error is in ASP.NET routes, is that ASP.NET as in pre-ASP.NET Core? I've not tied it in there, but I don't think they will work at all based on that error message, as it implies you can't use structs (which is required in the library at the moment)
No, this is specifically ASP.NET Core (3.1).
Urgh, looks like an SDK update has broken the build, will have to try and fix that first before I can fix this ðŸ˜
Urgh, looks like an SDK update has broken the build, will have to try and fix that first before I can fix this ðŸ˜
No worries, thanks for the update :-)
This took rather too long to address, sorry 😳
I've released a beta version of a major update to the library 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! It fixes this issue too.
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! 🙂
I believe this is solved in the latest betas, so I'll close it for now. Feel free to reopen if you still have any issues
When I tried to access a route in ASP.NET with a strongly typed paramter I kept getting the following error:
I had real trouble finding the problem as I had the code working prior to using the
StronglyTypedId
library itself. After much hunting I found the offending line:https://github.com/andrewlock/StronglyTypedId/blob/4b533c1552cc06d11b12f6cd8843cc3a089dc54d/src/StronglyTypedId.Generator/templates/IntId.cs#L34
In the example on your website here
typeof(string)
is used in place oftypeof(int)
. The example is for aGuid
and not anint
but the behaviour is the same when used with ASP.NET routes (which is what I thought that snippet was for). FWIW the Long template also referencesint
. Shall I fix?