Пример #1
0
        /// <summary>
        /// Gets the default manager instantiated with the specified site and an existing SharePoint object cache.
        /// Actual type of the created manager can be set through <see cref="SPModelManagerDefaultTypeAttribute"/> on the model type.
        /// If there is no <see cref="SPModelManagerDefaultTypeAttribute"/> specified, an <see cref="SPModelManager{T}"/> object is instantiated with <paramref name="type"/>.
        /// </summary>
        /// <param name="type">Model type.</param>
        /// <param name="contextWeb">A site object.</param>
        /// <param name="cache">An instance of SharePoint object cache.</param>
        /// <returns>A manager object.</returns>
        public static ISPModelManager GetDefaultManager(Type type, SPWeb contextWeb, SPObjectCache cache)
        {
            SPModelDescriptor       descriptor = SPModelDescriptor.Resolve(type);
            ISPModelManagerInternal manager    = descriptor.CreateManager(contextWeb);

            manager.ObjectCache = cache;
            return(manager);
        }
Пример #2
0
        /// <summary>
        /// Gets the default manager instantiated with the specified site.
        /// Actual type of the created manager can be set through <see cref="SPModelManagerDefaultTypeAttribute"/> on the model type.
        /// If there is no <see cref="SPModelManagerDefaultTypeAttribute"/> specified, an <see cref="SPModelManager{T}"/> object is instantiated with <paramref name="type"/>.
        /// </summary>
        /// <param name="type">Model type.</param>
        /// <param name="contextWeb">A site object.</param>
        /// <returns>A manager object.</returns>
        public static ISPModelManager GetDefaultManager(Type type, SPWeb contextWeb)
        {
            SPModelDescriptor descriptor = SPModelDescriptor.Resolve(type);

            return(descriptor.CreateManager(contextWeb));
        }