//Set Parent ID for the rest of the Reports data sources
this.ReportDataSources.ToList().ForEach(rds => rds.Parent = reportDataSource);
Почему я не могу установить родительский идентификатор напрямую? что может позволить LINQ предотвратить такое действие
//Set Parent ID for the rest of the Reports data sources
this.ReportDataSources.ToList().ForEach(rds => rds.ParentID = reportDataSource.ID);
Исключение, брошенное сюда
[Column(Storage="_ParentID", DbType="Int")]
public System.Nullable<int> ParentID
{
get
{
return this._ParentID;
}
set
{
if ((this._ParentID != value))
{
if (this._Parent.HasLoadedOrAssignedValue)
{
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
}
this.OnParentIDChanging(value);
this.SendPropertyChanging();
this._ParentID = value;
this.SendPropertyChanged("ParentID");
this.OnParentIDChanged();
}
}
}