Beispiel #1
0
        public static IQueryable <T> Query <T>(this ISPModelManager manager, string[] keywords, KeywordInclusion keywordInclusion)
        {
            Type modelType = ((ISPModelManagerInternal)manager).Descriptor.ModelType;
            Type queryType = typeof(SPModelQuery <>).MakeGenericType(modelType);

            return(((IQueryable)queryType.CreateInstance(new SPModelQueryProvider((ISPModelManagerInternal)manager, keywords, keywordInclusion))).OfType <T>());
        }
        /// <summary>
        /// Creates a LINQ queryable interface.
        /// </summary>
        /// <typeparam name="T">Model type.</typeparam>
        /// <param name="manager">A model manager instance.</param>
        /// <returns>A LINQ queryable interface.</returns>
        public static IQueryable <T> Query <T>(this ISPModelManager manager)
        {
            Type   modelType         = ((ISPModelManagerInternal)manager).Descriptor.ModelType;
            Type   queryProviderType = typeof(SPModelQueryProvider <>).MakeGenericType(modelType);
            Type   queryType         = typeof(SPModelQuery <>).MakeGenericType(modelType);
            object queryProvider     = Activator.CreateInstance(queryProviderType, manager);

            return(((IQueryable)Activator.CreateInstance(queryType, queryProvider)).OfType <T>());
        }
Beispiel #3
0
 /// <summary>
 /// Creates a model object representing the list item.
 /// </summary>
 /// <param name="adapter">A data access adapter of the list item.</param>
 /// <param name="manager">An instance of the <see cref="ISPModelManager"/> class which model object created will belongs to this manager.</param>
 /// <returns>A model object or *null* if there is no types associated with the content type of the list item.</returns>
 public static SPModel TryCreate(ISPListItemAdapter adapter, ISPModelManager manager)
 {
     CommonHelper.ConfirmNotNull(manager, "manager");
     return(((ISPModelManagerInternal)manager).TryCreateModel(adapter, false));
 }
 public CamlParameterBindingHashtable(ISPModelManager manager)
 {
     CommonHelper.ConfirmNotNull(manager, "manager");
     this.manager = (ISPModelManagerInternal)manager;
 }