我有两个班级
public class A
{
public string Name { get; set; }
}
public class B
{
public int Id { get; set; }
public A MemberA { get;set; }
}
如何正确地进行查询以将结果映射到所有成员?
var query = "SELECT [Table1].[Id] as [Id], [Table2].[Name] as [Member_A].[Name] FROM [Table1]"; // this is more complex query, there are more tables, columns, joins
ObjectResult<B> result = _context.ObjectContext.ExecuteStoreQuery<B>(query);
这不起作用。 result.MemberA
为空。如何制作?