خرید بک لینک

Vote count: 0

My project is using EF7-RC1. My query should retu a list of anonymous types however if a value is null the result will be empty.

I've tried to fix this problem with the following:

            var testQuery = (from com in db.Complaints
                select new
                {
                    ComplaintName = com.ComplaintName,
                    ProjectName = com.Project.ProjectName,
                    RemarkClient = com.RemarkClientNavigation != null ? com.RemarkClientNavigation.RemarkText : "n/a",
                    RemarkArchitect = com.RemarkArchitectNavigation != null ? com.RemarkArchitectNavigation.RemarkText : "n/a",
                }).ToList();

I've also tried using .DefaultIfEmpty() and a null coalescing operator, however the query result will still retu empty.

How can I get my query to retu results even if the value is null?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 21 فروردين 1395 ساعت: 13:33

صفحه بندی