I was initializing the object in the code below using simple properties but then refactored elsewhere such that DispatchedDocumentDate became DispatchedPhase.DocumentDate. I did this because there is also sold and picked classes using precisely the same properties.
So now in a referencing assembly I have this code which doesn't compile:
public List<ItemMovementEntry> FillItemDispatchMovements(IEntityDateRange imqp)
{
var f = from detail in this.Context.DispatchDetails
join header in this.Context.Dispatches on detail.ClientOrderNumber equals header.ClientOrderNumber
where (detail.ProductCode == imqp.ItemKey)
&& (header.DateOrdered >= imqp.StartDate)
&& (header.DateOrdered <= imqp.EndDate)
orderby header.DateOrdered descending
select new ItemMovementEntry(ItemMovementEntryKind.Dispatch)
{
DispatchedPhase.DocumentDate = ((header.DateOrdered.HasValue) ? header.DateOrdered.Value : new DateTime(1900, 1, 1)),
DispatchedPhase.DocumentLKey = header.ClientOrderNumber,
MaterialItemLkey = detail.ProductCode,
DispatchedPhase.MovementDeltaQty = ((detail.QuantityDelivered.HasValue) ? (-1) * detail.QuantityDelivered.Value : 0),
DispatchedPhase.Comment = string.Empty,
JournalType = "DISPATCHED",
};
return f.ToList<ItemMovementEntry>();
}
I get an :
Invalid initializer member declarator
error message.
Hopefully the intent is clear but I'm not sure how to rewrite. I Googled and got something about Let but it was still unclear.