Exemple #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            var app = CreateConfigureBooksApp();

            SwaggerConfig.Register();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            GlobalConfiguration.Configuration.EnableCors();
            GlobalConfiguration.Configuration.EnsureInitialized();

            //Create sample data, import books
            var session = app.OpenSystemSession();

            if (session.EntitySet <IUser>().Count() == 0)
            {
                SampleDataGenerator.CreateBasicTestData(app);
            }
            if (session.EntitySet <IBook>().Count() < 100)
            {
                var import = new GoogleBooksImport();
                import.ImportBooks(app, 200);
            }
        }