title: Get Value from other Table by ID with Entity Framework
body: <p>i have two already existings tables (no foreignkey):</p>
  
  <p>Customer (Id, Name, .....)
  Projects (Id, CustomerId, name)</p>
  
  <p>And in my asp.net core application i have two model:</p>
  
  <pre><code>public class Customer {
     public int Id { get; set; };
     public String Name { get; set; };
  }
  
  public class Project {
     public int Id { get; set; };
     public Customer Customer{ get; set; };
     public String Name{ get; set; };
  }
  </code></pre>
  
  <p>And the datacontext classes for this </p>
  
  <pre><code>public class CustomerContext: DbContext
  {
      public CustomerContext(DbContextOptions&lt;CustomerContext&gt; options) : base(options)
      {
      }
  
      public DbSet&lt;CustomerContext&gt; Customer { get; set; }
  }
  
  public class ProjectContext: DbContext
  {
      public ProjectContext(DbContextOptions&lt;ProjectContext&gt; options) : base(options)
      {
      }
  
      public DbSet&lt;ProjectContext&gt; Project{ get; set; }
  }
  </code></pre>
  
  <p>But i cant find out how to fetch the Customer object in the Projectclass by the customerId</p>
  
  <p>Can someone help me please? Thank you</p>
  
  <p>Edit: Now i change my Model Classes like in the answer below</p>
  
  <p>but with the following i get an SQL Exception while loading the page
  SqlException: Invalid object name 'Customer'.</p>
  
  <pre><code>        projectList = await (from project in _context.Project
                                       join customer in _customerContext.Customer on project.CustomerId equals customer.Id into tmp
                                       from m in tmp.DefaultIfEmpty()
  
                                       select new Project
                                       {
                                           Id = sollIst.Id,
                                           CustomerId = sollIst.CustomerId,
                                           Customer = m,
                                           Name = sollIst.Name,
                                       }
                        ).ToListAsync();
  </code></pre>