public void Configuration(IAppBuilder app) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/auth/login") }); // configure the user manager UserManagerFactory = () => { var usermanager = new UserManager <AppUser>( new UserStore <AppUser>(new AppDbContext())); // allow alphanumeric characters in username usermanager.UserValidator = new UserValidator <AppUser>(usermanager) { AllowOnlyAlphanumericUserNames = false }; usermanager.ClaimsIdentityFactory = new AppUserClaimsIdentityFactory(); var provider = new Microsoft.Owin.Security.DataProtection.DpapiDataProtectionProvider("Booktrade"); usermanager.UserTokenProvider = new Microsoft.AspNet.Identity.Owin.DataProtectorTokenProvider <AppUser>(provider.Create("PasswordReset")); return(usermanager); }; LuceneSearchIndexer.UpdateBooksIndex(); }
public static void UpdateBooksIndex() { string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (System.IO.Directory.Exists(System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName + @".\LuceneIndex")) { System.IO.Directory.Delete(System.IO.Directory.GetParent(System.IO.Directory.GetCurrentDirectory()).Parent.FullName + @".\LuceneIndex", true); } var context = new AppDbContext(); List <Book> books = context.Books.Where(x => x.isSold == false && x.isChanged == false).ToList(); LuceneSearchIndexer.RunIndex(books); }