Ejemplo n.º 1
0
        /// <param name="persistantObjectName">Will be used as CustomObject name to get the object instance</param>
        public static PageFile GetInstance(ConnectionList connectionList, string connectionID, string persistantObjectName=null, HttpRequest request=null, Func<PageFile> createCallback=null)
        {
            if( persistantObjectName == null )
            {
                if( request == null )
                    throw new ArgumentException( "Either 'fileID' parameter or 'request' must be specified" );
                persistantObjectName = request.QueryString[ RqstFileID ];
            }
            if( string.IsNullOrEmpty(persistantObjectName) )
                throw new ArgumentException( "The connection's custom object name could not be determined. Either the 'fileID' parameter must be set or the 'request' must contain the HTTP parameter '" + RqstFileID + "'" );

            PageFile instance;
            if( createCallback == null )
            {
                instance = (PageFile)connectionList.GetConnectionCustomObject( connectionID, persistantObjectName );
            }
            else
            {
             				Func<object> createPageFileCallback = ()=>{ return createCallback(); };
                instance = (PageFile)connectionList.GetConnectionCustomObject( connectionID, persistantObjectName, createPageFileCallback );
            }
            return instance;
        }