通过实体框架连接返回通用列表

我正在使用Entity Framework,并且想要联接2个表,然后将其作为列表返回。

But my method returns List<contact> (contact is a table in my DB) and I can't return it. Because of the new object, not like contact, how I can't return my result?

这是我的代码

public List<contact> GetAllContact()
{
     return db.contact.Where(c => c.deleted_at == null)
                      .Join(db.contact_image, contact => contact.id, image => image.contact_id, 
                            (contact, image) => new { 
                                                        contact.id,
                                                        contact.first_name,
                                                        contact.last_name,
                                                        contact.mobile,
                                                        contact.email,
                                                        contact.brithday,
                                                        contact.brithday_fa,
                                                        contact.created_at,
                                                        contact.updated_at,
                                                        contact.deleted_at,
                                                        image.image
                                                    }).ToList();
}
评论