Public class Student { [Key] Public int Id {get; set; } Public string Name {get; set; } Public StudentAddress StudentAddress {get; set; } }
Public partial class StudentAddress { [Key, ForeignKey (" Student ")] Public int Studentid {get; set; } Public string City {get; set; } Public string Zipcode {get; set; } Public string Country {get; set; } Public Student Student {get; set; } }
Asked to query the all Student information
CodePudding user response:
Var studentinfo=(from x in student Join in studentaddress on x.i d y equals y.s tudentid Where x.i d==XXX). Select (z=& gt; New {student=z.x, studentaddress=z.y}). The first ()