Example #1
0
        private void generateWebConfigAndCodeForWebProject(DevelopmentInstallation installation, WebProject project)
        {
            var application = installation.ExistingInstallationLogic.RuntimeConfiguration.WebApplications.Single(i => i.Name == project.name);

            // This must be done before web meta logic generation, which can be affected by the contents of Web.config files.
            WebConfigStatics.GenerateWebConfig(application, project);

            var webProjectGeneratedCodeFolderPath = EwlStatics.CombinePaths(application.Path, "Generated Code");

            Directory.CreateDirectory(webProjectGeneratedCodeFolderPath);
            var webProjectIsuFilePath = EwlStatics.CombinePaths(webProjectGeneratedCodeFolderPath, "ISU.cs");

            IoMethods.DeleteFile(webProjectIsuFilePath);
            using (TextWriter writer = new StreamWriter(webProjectIsuFilePath)) {
                writer.WriteLine("using System;");
                writer.WriteLine("using System.Collections.Generic;");
                writer.WriteLine("using System.Collections.ObjectModel;");
                writer.WriteLine("using System.Globalization;");
                writer.WriteLine("using System.Linq;");
                writer.WriteLine("using System.Reflection;");
                writer.WriteLine("using System.Runtime.InteropServices;");
                writer.WriteLine("using System.Web;");
                writer.WriteLine("using System.Web.UI;");
                writer.WriteLine("using System.Web.UI.WebControls;");
                writer.WriteLine("using EnterpriseWebLibrary;");
                writer.WriteLine("using EnterpriseWebLibrary.DataAccess;");
                writer.WriteLine("using EnterpriseWebLibrary.EnterpriseWebFramework;");
                writer.WriteLine("using EnterpriseWebLibrary.EnterpriseWebFramework.Controls;");
                writer.WriteLine("using EnterpriseWebLibrary.InputValidation;");
                writer.WriteLine();
                writeAssemblyInfo(writer, installation, project.name);
                writer.WriteLine();
                CodeGeneration.WebMetaLogic.WebMetaLogicStatics.Generate(writer, application.Path, project);
            }
        }
        private void generateWebConfigAndCodeForWebProject(DevelopmentInstallation installation, WebProject project)
        {
            var application = installation.ExistingInstallationLogic.RuntimeConfiguration.WebApplications.Single(i => i.Name == project.name);

            // This must be done before web meta logic generation, which can be affected by the contents of Web.config files.
            WebConfigStatics.GenerateWebConfig(application, project);

            Directory.CreateDirectory(EwlStatics.CombinePaths(application.Path, StaticFile.AppStaticFilesFolderName));

            var webProjectGeneratedCodeFolderPath = EwlStatics.CombinePaths(application.Path, generatedCodeFolderName);

            Directory.CreateDirectory(webProjectGeneratedCodeFolderPath);
            var webProjectIsuFilePath = EwlStatics.CombinePaths(webProjectGeneratedCodeFolderPath, "ISU.cs");

            IoMethods.DeleteFile(webProjectIsuFilePath);
            using (TextWriter writer = new StreamWriter(webProjectIsuFilePath)) {
                writer.WriteLine("using System;");
                writer.WriteLine("using System.Collections.Generic;");
                writer.WriteLine("using System.Collections.ObjectModel;");
                writer.WriteLine("using System.Globalization;");
                writer.WriteLine("using System.Linq;");
                writer.WriteLine("using System.Reflection;");
                writer.WriteLine("using System.Runtime.InteropServices;");
                writer.WriteLine("using System.Threading;");
                writer.WriteLine("using EnterpriseWebLibrary;");
                writer.WriteLine("using EnterpriseWebLibrary.DataAccess;");
                writer.WriteLine("using EnterpriseWebLibrary.EnterpriseWebFramework;");
                writer.WriteLine("using NodaTime;");
                writer.WriteLine("using Tewl.InputValidation;");
                writer.WriteLine("using Tewl.Tools;");
                writer.WriteLine();
                writeAssemblyInfo(writer, installation, project.name);
                writer.WriteLine();
                writer.WriteLine("namespace {0}.Providers {{".FormatWith(project.NamespaceAndAssemblyName));
                writer.WriteLine("internal partial class RequestDispatching: AppRequestDispatchingProvider {");
                writer.WriteLine(
                    "protected override UrlPattern GetStaticFilesFolderUrlPattern( string urlSegment ) => StaticFiles.FolderSetup.UrlPatterns.Literal( urlSegment );");
                writer.WriteLine("}");
                writer.WriteLine("}");
                writer.WriteLine();
                CodeGeneration.WebFramework.WebFrameworkStatics.Generate(
                    writer,
                    application.Path,
                    project.NamespaceAndAssemblyName,
                    false,
                    generatedCodeFolderName.ToCollection(),
                    StaticFile.AppStaticFilesFolderName,
                    "RequestDispatchingStatics.AppProvider.GetFrameworkUrlParent()");
            }
        }