Closed nhuthan closed 2 years ago
Yeah, that's an inherent problem with using a reference type in the struct. The question is, how would you expect this to behave? We could throw if you try to create a UserId with a null string. We could use ?.
in the CompareTo
. What are your thoughts?
@andrewlock I think use ?.
is good idea. It will working well for EF.
I created a pull request here https://github.com/andrewlock/StronglyTypedId/pull/33
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 issue is solved in the 1.0.0 beta release, so closing this for now. Feel free to re-open if it doesn't work for you
Example code