How this will work depends entirely on your Entity Framework approach.
If this is your database, and you're using Code First, the very best thing that you can do is define Navigation properties on your model classses. For instance:
public class Users
{
...
public virtual ICollection<Letter> Letters { get; set;}
}
public class Letter
{
...
[ForeignKey("User")]
public int UserId { get; set; }
[JsonIgnore]
public virtual Users User { get; set; }
}
public string ShowUser(int id)
{
using (Test02Entities _Test02Entities = new Test02Entities())
{
var user = _Test02Entities.Users.Find(id);
return JsonConvert.SerializeObject(_Join);
}
}
The JsonIgnore attribute will avoid the circular reference serialization issue. You can change this based on need, but that's outside the scope of a quick answer.
This pattern leverages the natural relational nature of data in a relational database to provide automatic joins, and is really one of the best ways to use Entity Framework (IMO).
As a side note, avoid using SingleOrDefault() if at all possible in EF as that will enumerate the entire table. FirstOrDefault() will stop enumeration when the condition is met, and Find() will pull directly by row key.
There is a primer for Navigation properties at:
Entity Framework Relationships & Navigation Properties[
^].
If you're using Database First, you can do exactly the same thing by adding Associations to the edmx file. This approach is not as firmly in my realm, but there is a solid reference at:
Entity Framework Relationships - EF Designer[
^]