c# - EF6 Navigation Properties map empty collection instead of null -


I have a number of accounts with institutions that use Linux to bring one in many relationships.

  var query = c in db.Client where c.MetaProps.Deleteflag == 0 & amp; Amp; Select C.ContractNumber.Equals (clientNumber) new {client = c, account = c. ACC Where (a => one.isactive),}; Contract = query FirstOver Default (). Customer;  

The problem is that when there is no account in DB, the accounting list is zero. Is it a blank list, such as . Include () is used?

Of course, you can use a null colloicing operator.

  var in query = to db.Client where c.MetaProps.Deleteflag == 0 & amp; Amp; Select C.ContractNumber.Equals (clientNumber) new {client = c, account = c. ACC Where (a => a.IsActive) ?? Countable Empty & lt; Account & gt; ()}; Contract = query FirstOver Default (). Customer;  

Comments