I use linq to entities to query the DB, sometimes I need to bring extra information from the joined tables (without navigational property),I extended the entity to hold the info, my question is how can I set the extra properties without having to remap all it's base properties.
ex
from s in db.t1
join p in db.t2 on s.indx equals p.indx into ps
from c in ps.DefaultIfEmpty()
select new t1() { p1 = s.p1, p2 = s.p2 ..., extra = c.extra }
so can I set just the 'extra' value in a fast way !
Why can't you just use an anonymous object?
from s in db.t1
join p in db.t2 on s.indx equals p.indx into ps
from c in ps.DefaultIfEmpty()
select new
{
p1 = s.p1,
p2 = s.p2,
extra = c.extra
}
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.