loading...

re: How C# 8 Helps Software Quality VIEW POST

FULL DISCUSSION
 

Great article as usual! So have you tried using Entity Framework Core (EFCore) with the non-nullable references?

I’m wondering if that improves things.

For instance, in some ORMs a findById operation returns T but in reality, a findByIdoperation always has the potential to not find the item. So the correct return type is T | null.

It’s just another good example of communicating intent.

 

generics and nullable won't play nicely
I yet have to experiment, but bear in mind that this nullable feature when used on generics requires you to express whether the generic type is either a reference type or a value type (aka where T: class or where T: struct). And since you can't combine both constraints - well... :) It leaves me wondering ;)

 

Interesting. I’d love to hear your findings after you experiment. If you write an article, please link it here. :)

code of conduct - report abuse