/// <summary> /// Gets the list. /// </summary> /// <typeparam name="TEntity">The type of the entity.</typeparam> /// <param name="listName">Name of the list.</param> /// <returns></returns> public virtual EntityList <TEntity> GetList <TEntity>(string listName) where TEntity : class, ITrackEntityState, ITrackOriginalValues, INotifyPropertyChanged, INotifyPropertyChanging, new() { IEntityListItemsCollection _nwLst = GetOrCreateListEntry <TEntity>(listName); return(new EntityList <TEntity>(this, (EntityListItemsCollection <TEntity>)_nwLst, listName, RowLimit)); }
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 Dictionary <int, Object> GetListItemCollection <TEntity>(AssociationAttribute associationInfo, int m_Id) where TEntity : class, ITrackEntityState, ITrackOriginalValues, INotifyPropertyChanged, INotifyPropertyChanging, new() { IEntityListItemsCollection _newList = GetOrCreateListEntry <TEntity>(associationInfo.List); return(_newList.GetEntitiesForReverseLookup(associationInfo.Name, m_Id)); }
internal int GetIndex <TEntity>(AssociationAttribute associations, TEntity item) where TEntity : class, ITrackEntityState, ITrackOriginalValues, INotifyPropertyChanged, INotifyPropertyChanging, new() { IEntityListItemsCollection _newList = GetOrCreateListEntry <TEntity>(associations.List); return(_newList.GetIndex(item)); }
internal TEntity GetFieldLookupValue <TEntity>(string listName, FieldLookupValue fieldLookupValue) where TEntity : class, ITrackEntityState, ITrackOriginalValues, INotifyPropertyChanged, INotifyPropertyChanging, new() { IEntityListItemsCollection _newList = GetOrCreateListEntry <TEntity>(listName); return((TEntity)_newList.GetFieldLookupValue(fieldLookupValue)); }