On pg 177 of NerdDinner, you create a sample dinner object using the following:
Code:
Dinner
sampleDinner = new Dinner() {
DinnerID = i,
Title =
"Sample Dinner",
HostedBy =
"Some Address",
Country =
"425-555-1212",
Description =
"Some description",
EventDate =
DateTime.Now.AddDays(i),
Latitude = 99,
Longitude = -99
};
My question is how do you do this if DinnerID is a read-only property. Since DinnerID normally comes from the database, wouldn't this normally be read-only and unavailable to be set in an initializer like this?