Exemple #1
0
        /// <summary>
        /// Creates a new lazy loading thunk referring to the containing list source and the id of the child entities as represented by <typeparamref name="R">R</typeparamref>. Used for LookupMulti fields.
        /// </summary>
        /// <param name="context">Context source. Will be used to get the child entities from the list represented by <typeparamref name="R">R</typeparamref>.</param>
        /// <param name="ids">List of unique ids of the entities to be loaded from the child (lookup) list.</param>
        public LazyLoadingThunk(SharePointDataContext context, int[] ids)
        {
            Debug.Assert(context != null && ids != null);

            this.context = context;
            this.ids     = ids;
        }
Exemple #2
0
        /// <summary>
        /// Creates a new lazy loading thunk referring to the context source and the id of the child entity as represented by <typeparamref name="R">R</typeparamref>. Used for Lookup fields.
        /// </summary>
        /// <param name="context">Context source. Will be used to get the child entity from the list represented by <typeparamref name="R">R</typeparamref>.</param>
        /// <param name="id">Unique id of the entity to be loaded from the child (lookup) list.</param>
        public LazyLoadingThunk(SharePointDataContext context, int id)
        {
            Debug.Assert(context != null);

            this.context = context;
            this.id      = id;
        }
Exemple #3
0
        /// <summary>
        /// Create a list source object for querying of a SharePoint list.
        /// </summary>
        /// <param name="context">Data context object used to connect to SharePoint.</param>
        public SharePointList(SharePointDataContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _context = context;
            _context.RegisterList(this);
        }
Exemple #4
0
 /// <summary>
 /// Gets a query provider for the specified data context.
 /// </summary>
 /// <param name="context">Data context to get a query provider for.</param>
 /// <returns>Query provider for the specified data context.</returns>
 public static SharePointListQueryProvider GetInstance(SharePointDataContext context)
 {
     if (providers.Contains(context))
     {
         return((SharePointListQueryProvider)providers[context]);
     }
     else
     {
         return(new SharePointListQueryProvider(context));
     }
 }
Exemple #5
0
        /// <summary>
        /// Creates an entity reference for deferred loading.
        /// </summary>
        /// <param name="context">Context used to load the entity.</param>
        /// <param name="id">Primary key of the entity to be loaded.</param>
        internal EntityRef(SharePointDataContext context, int id)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _list   = context.GetList <T>();
            _id     = id;
            _entity = default(T);
            _loaded = false;
        }
        /// <summary>
        /// Create a list source object for querying of a SharePoint list.
        /// </summary>
        /// <param name="context">Data context object used to connect to SharePoint.</param>
        /// <param name="autoRegister">Indicates whether or not the list should be registered with the context.</param>
        internal SharePointList(SharePointDataContext context, bool autoRegister)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            _context = context;

            if (autoRegister)
            {
                _context.RegisterList(this);
            }
        }
Exemple #7
0
        /// <summary>
        /// Creates a set of entity references for lazy loading.
        /// </summary>
        /// <param name="context">Context used to load the entities.</param>
        /// <param name="ids">Primary keys of the entities to be loaded.</param>
        /// <param name="onAdd">Action to take when an entity is added to the set.</param>
        /// <param name="onRemove">Action to take when an entity is removed from the set.</param>
        internal EntitySet(SharePointDataContext context, int[] ids, Action <T> onAdd, Action <T> onRemove)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (ids == null)
            {
                throw new ArgumentNullException("ids");
            }

            _list     = context.GetList <T>();
            _ids      = ids;
            _entities = null;
            _loaded   = false;
            _onAdd    = onAdd;
            _onRemove = onRemove;
        }
Exemple #8
0
 /// <summary>
 /// Internal constructor for the query provider.
 /// </summary>
 /// <param name="context">Data context to create a query provider for.</param>
 internal SharePointListQueryProvider(SharePointDataContext context)
 {
     _context = context;
     providers.Add(context, this);
 }
 /// <summary>
 /// Creates a query object for querying a SharePoint list.
 /// </summary>
 /// <param name="context">Data context object used to connect to SharePoint.</param>
 /// <param name="expression">Expression representing the query.</param>
 public SharePointListQuery(SharePointDataContext context, Expression expression)
 {
     _context    = context;
     _expression = expression;
 }
Exemple #10
0
 /// <summary>
 /// Create a list source object for querying of a SharePoint list.
 /// </summary>
 /// <param name="context">Data context object used to connect to SharePoint.</param>
 public SharePointList(SharePointDataContext context) : this(context, true)
 {
 }