Exemple #1
0
 protected void Application_Start()
 {
     //读取了配置文件中关于Log4Net配置信息.
     log4net.Config.XmlConfigurator.Configure();
     //开始线程扫描LuceneNet对应的数据队列。
     IndexManager.CreateInstance().StartThread();
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     //开启一个线程,扫描异常信息队列
     ThreadPool.QueueUserWorkItem(HandleExceptionQueue, Server.MapPath("/Log"));
 }
Exemple #2
0
 /// <summary>
 /// 测试IndexManager
 /// </summary>
 /// <returns></returns>
 public ActionResult TestCreate()
 {
     Model.Books model = new Model.Books();
     model.AurhorDescription  = "jlkfdjf";
     model.Author             = "asfasd";
     model.CategoryId         = 1;
     model.Clicks             = 1;
     model.ContentDescription = "卢本伟牛逼,披着国旗在国际舞台上叱咤风云!";
     model.EditorComment      = "adfsadfsadf";
     model.ISBN        = "111111111111111111";
     model.PublishDate = DateTime.Now;
     model.PublisherId = 72;
     model.Title       = "卢本伟的一生";
     model.TOC         = "aaaaaaaaaaaaaaaa";
     model.UnitPrice   = 22.3m;
     model.WordsCount  = 1234;
     //将数据先存储到数据库中。获取刚插入的数据的主键ID值。
     IBLL.IBooksBll booksBll = new BooksBll();
     model = booksBll.AddEntity(model);
     IndexManager.CreateInstance().AddToLucene(model.Id, model.Title, model.ContentDescription);//向队列中添加
     return(Content("ok"));
 }