I have a question about using Entity Framework.
I want to access a property of a model connected with another model. But if "parent" object is Null, the ?? operator does not help.
For example: My Customer model has Company model inside. I want to access Customer.Company.Name property. Where the Customer object is allready null, I get the null object reff error.
Sample of accessing the property on null object
If the object is null I would like it to return "". One solution is to write a loner code like:
(Customer!=null) ? ((Customer.Company!=null) ? Customer.Company.Name ?? "" : "" ) : ""
I know this is not the clean way, but there would be nice if there is a solution like ?? which detects null in parent object, too.