Answers for "tables join in entity core"

0

tables join in entity core

var query = context.Customers
    .Join(
        context.Invoices,
        customer => customer.CustomerId,
        invoice => invoice.Customer.CustomerId,
        (customer, invoice) => new
        {
            InvoiceID = invoice.Id,
            CustomerName = customer.FirstName + "" + customer.LastName,
            InvoiceDate = invoice.Date
        }
    ).ToList();

foreach (var invoice in query)
{
    Console.WriteLine("InvoiceID: {0}, Customer Name: {1} " + "Date: {2} ",
        invoice.InvoiceID, invoice.CustomerName, invoice.InvoiceDate);
}
Posted by: Guest on April-07-2022

Code answers related to "tables join in entity core"

Browse Popular Code Answers by Language