private IEntityListItemsCollection GetOrCreateListEntry <TEntity>(string listName) where TEntity : class, ITrackEntityState, ITrackOriginalValues, INotifyPropertyChanged, INotifyPropertyChanging, new() { Debug.Assert(!String.IsNullOrEmpty(listName), "listName null in GetOrCreateListEntry."); IEntityListItemsCollection _nwLst = null; if (!m_AllLists.TryGetValue(listName, out _nwLst)) { List _list = null; // Execute the prepared commands against the target ClientContext RetryExecuteQuery(new ProgressChangedEventArgs(1, String.Format("Loading list = {0}", listName)), () => { _list = m_RootWeb.Lists.GetByTitle(listName); m_ClientContext.Load <List>(_list); } ); _nwLst = new EntityListItemsCollection <TEntity>(this, _list); m_AllLists.Add(listName, _nwLst); } else { _nwLst = m_AllLists[listName]; } return(_nwLst); }
internal EntityList(DataContext dataContext, EntityListItemsCollection <TEntity> itemsCollection, string listName, int rowLimit) { this.m_ListName = listName; this.Query = CamlQueryDefinition.CAMLAllItemsQuery(rowLimit); this.m_AllItemsCollection = itemsCollection; this.DataContext = dataContext; }
internal void LoadListItem <TEntity>(int fieldLookupValue, EntityListItemsCollection <TEntity> entityListItemsCollection) where TEntity : class, ITrackEntityState, ITrackOriginalValues, INotifyPropertyChanged, INotifyPropertyChanging, new() { GetListItemCollection(entityListItemsCollection.MyList, CamlQueryDefinition.GetCAMLSelectedID(fieldLookupValue), x => { foreach (ListItem _listItemx in x) { entityListItemsCollection.Add(_listItemx); } }); }