Ejemplo n.º 1
0
        /// <summary>
        /// Properly creates a new PageQuery. That means that after the setting of URL and depth, you can call .Scrape()
        /// and actually download some webpages.
        /// </summary>
        public async Task <PageQuery> CreateNew()
        {
            PageQueryData data = new PageQueryData();

            Context.PageQueries.Add(data);
            Context.SaveChanges();
            return(GetByData(data));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Helper method to obtain PageQuery from its database entity.
        /// </summary>
        /// <param name="data">Database entity</param>
        public PageQuery GetByData(PageQueryData data)
        {
            if (data.WrapperPageQuery == null)
            {
                data.WrapperPageQuery = new PageQuery(data, this);
            }

            return(data.WrapperPageQuery);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns already created PageQuery. It is possible to rescrape it or change its properties.
        /// </summary>
        /// <param name="Id">Unique numeric identifier of PageQuery</param>
        public PageQuery GetById(int Id)
        {
            PageQueryData data = Context.PageQueries.Find(Id);

            if (data == null)
            {
                return(null);
            }

            return(GetByData(data));
        }