I am using Linq DataContext.ExecuteQuery ("some sql statement") to populate a list of objects
var incomes = db.ExecuteQuery<IncomeAggregate>(sqlIncomeStatement(TimeUnit));
IncomeAggregate is an object that I created to store the results of this query.
One of the properties of this object is YQM:
public int Year { get; set; }
public int Quarter { get; set; }
public int Month { get; set; }
public string YQM
{
get { return string.Format("Y{0}-Q{1}-M{2}", Year, Quarter, Month); }
}
... more properties
Everything compiles in order, but when it executes Linq, I get the following error:
Unable to assign value to YQM member. It does not define a setter.
But it is clear that I do not want to “install” it. Y, Q and M are provided by a query to the database. The request is not requested by YQM. Do I need to somehow change the definition of my object? (I just started using Linq, and I'm still gaining speed, so it can be very simple)