I have the following LINQ query that returns two objects from my database. These objects will be consumed by a ViewModel that is strongly typed to a display template:
public IQueryable<ICustomerSiteRepository> CustomerAndSites
{
get
{
return from customer in customerTable
join site in customerSitesTable
on customer.Id equals site.CustomerId
select new CustomersAndSitesMix(customer, site);
}
}
I am trying to create a new CustomersAndSitesMix class with a constructor that accepts two parameters (the customer and the site).
However, when I create the class and try to set up the constructor like so:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CustomerDatabase.Domain.Entities
{
public class CustomersAndSitesMix (CustomerSite custSite, Customer cust)
{
}
}
I get syntax errors stating that cannot use more than one type in a for, using or fixed declaration.
What am I doing wrong?
You should declare the class first: