When Entity Framework retrieves data from database and creates a new model class for that, how to pass values to the constructor instead of assigning them to the properties?
For example :
public class Customer
{
public string FirstName { get; set; }
public string LastName { get; set; }
public Customer(string firstName, string lastName)
{
}
}
So when I call to _context.Customers.ToList(); I want to pass values to the constructor, instead of assigning them to the properties.
ToList()has to do with constructors.