On a NameValueListBase class I've made, I'm throwing the "Insert is an invalid operation" in the DataPortal_Fetch. I've set RaiseChangedEvents to false before calling the Add operation. I'm starting to wonder if it has something to do with the Generic I'm also using in my class. I'm sort of trying something a little different here... Can this work? I don't see why it wouldn't...
[Serializable()]public class NewStatusCountsInfo<T> : Csla.NameValueListBase<T, int>
{
private NewStatusCountsInfo()
{ /* require use of factory method */}
internal static NewStatusCountsInfo<T> GetNewStatusCountsInfo(SafeDataReader dr)
{
return DataPortal.Fetch<NewStatusCountsInfo<T>>(dr);
}
[RunLocal()]
private void DataPortal_Fetch(SafeDataReader dr)
{
this.RaiseListChangedEvents = false;
Fetch(dr);
this.RaiseListChangedEvents = true;
}
private void Fetch(SafeDataReader dr)
{
while (dr.Read())
this.Add(new NameValuePair((T)(dr["Status"]), dr.GetInt32("Total")));
}
}
Copyright (c) Marimer LLC