im using L2S and i have to perform one left outer join with VisitFromTime and VisitToTime values in right table. code looks like
from d in db.Doctors
join p in db.plans on d.DoctorID equals p.DoctorID
into temp
from t in temp.DefaultIfEmpty()
select new MyModel
{
....
....
VisitTimeFrom = t!=null?t.VisitTimeFrom:new TimeSpan(),
VisitTimeTo = t!=null?t.VisitTimeTo:new TimeSpan()
}
it gives me runtime exception that explicit conversion from bigint to time is not supported in sql
is VisitTimeFrom and VisitTimeTo bigint in the database?
If so surely you want
VisitTimeFrom = t!=null?t.VisitTimeFrom:0,
VisitTimeTo = t!=null?t.VisitTimeTo:0
确保t.VisitTimeFrom
和t.VisitTimeTo
都是时间跨度。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.