ef core linq
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace HelloApp
{
public class Program
{
public static async Task Main(string[] args)
{
using (ApplicationContext db = new ApplicationContext())
{
var users = await db.Users
.Include(p => p.Company)
.Where(p => p.CompanyId == 1)
.ToListAsync(); // асинхронное получение данных
foreach (var user in users)
Console.WriteLine($"{user.Name} ({user.Age}) - {user.Company.Name}");
}
Console.Read();
}
}
}