public void Execute()
 {
     if (HostingEnvironment.IsHosted)
     {
         if (!done)
         {
             lock (SyncLock)
             {
                 if (!done)
                 {
                     done = true;
                     var path = HostingEnvironment.MapPath(Path.Combine(WebConstants.AssetsFolderPath, "js"));
                     KnockoutModelBuilder.Save(path);
                 }
             }
         }
     }
 }
示例#2
0
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

            if (env.IsDevelopment())
            {
                // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
                builder.AddUserSecrets();
                builder.AddApplicationInsightsSettings(developerMode: true);
            }

            builder.AddEnvironmentVariables();
            Configuration = builder.Build();
            KnockoutModelBuilder.Save(Path.Combine(env.WebRootPath, "js"), Assembly.GetEntryAssembly());
            AutoMapper.Mapper.Initialize(config =>
            {
                config.CreateMap <StudentModel, Student>();
                config.CreateMap <RoomFeesModel, RoomFees>();
                config.CreateMap <RoomFees, RoomFeesModel>();
            });
        }