Entity Framework“Code First”外键关联查询,如何对从表子段动态排序
什么叫“从表子段动态排序”?
关联表查询,向OrderBy传递字符串参数如果是子表参数,提示"没有为类型“xxxx”定义实例属性"
public class Online : IKeyID
{ [Key]
public int ID { get; set; }
[StringLength(50)]
public string IPAdddress { get; set; }
public DateTime LoginTime { get; set; }
public DateTime? UpdateTime { get; set; }
public virtual User User { get; set; }
}
public class User : IKeyID
{
[Key]
public int ID { get; set; }
[Required, StringLength(50)]
public string Name { get; set; }
[Required, StringLength(100)]
public string Email { get; set; }
[Required, StringLength(50)]
public string Password { get; set; }
[Required]
public bool Enabled { get; set; }
}