示例#1
0
        public static TerrificNetApplication RegisterForApplication(IUnityContainer childContainer, string hostPath, string basePath, string applicationName, string section)
        {
            try
            {
                var fileSystem = childContainer.Resolve <FileSystemProvider>().GetFileSystem(hostPath, basePath, out basePath);
                childContainer.RegisterInstance(fileSystem);

                var config      = ConfigurationLoader.LoadTerrificConfiguration(basePath, fileSystem);
                var application = new TerrificNetApplication(applicationName, section, config, childContainer);

                childContainer.RegisterInstance(application);
                RegisterForConfiguration(childContainer, config);

                return(application);
            }
            catch (ConfigurationException ex)
            {
                throw new InvalidApplicationException(string.Format("Could not load the configuration for application '{0}'.", applicationName), ex);
            }
        }
示例#2
0
        public static TerrificNetApplication RegisterForApplication(IUnityContainer childContainer, string hostPath, string basePath, string applicationName, string section)
        {
            try
            {
                var fileSystem = childContainer.Resolve<FileSystemProvider>().GetFileSystem(hostPath, basePath, out basePath);
                childContainer.RegisterInstance(fileSystem);

                var config = ConfigurationLoader.LoadTerrificConfiguration(basePath, fileSystem);
                var application = new TerrificNetApplication(applicationName, section, config, childContainer);

                childContainer.RegisterInstance(application);
                RegisterForConfiguration(childContainer, config);

                return application;
            }
            catch (ConfigurationException ex)
            {
                throw new InvalidApplicationException(string.Format("Could not load the configuration for application '{0}'.", applicationName), ex);
            }
        }
示例#3
0
        public static TerrificNetApplication RegisterForApplication(IUnityContainer childContainer, string hostPath, string basePath, string applicationName, string section)
        {
            try
            {
                var fileSystem = childContainer.Resolve<FileSystemProvider>().GetFileSystem(hostPath, basePath, out basePath);
                childContainer.RegisterInstance(fileSystem);

                var config = ConfigurationLoader.LoadTerrificConfiguration(basePath, fileSystem);
                var application = new TerrificNetApplication(applicationName, section, config, childContainer);

                var projectPath = PathInfo.Create("terrific.json");
                if (fileSystem.FileExists(projectPath))
                {
                    var project = Project.FromFile(new StreamReader(fileSystem.OpenRead(projectPath)).ReadToEnd(), fileSystem);
                    childContainer.RegisterInstance(project);

                    var builder = new Builder(project);
                    var pId = new ProjectItemIdentifier("app.js", "javascript_bundle");

                    builder.AddTask(new BundleTask("app.js", pId));
                    builder.AddTask(new CompileJavascriptTask(pId, "app.min.js"));
                    builder.AddTask(new BuildViewTask(project));
                    builder.AddTask(new BuildThtmlTask(project));
                }

                childContainer.RegisterInstance(application);
                RegisterForConfiguration(childContainer, config);

                return application;
            }
            catch (ConfigurationException ex)
            {
                throw new InvalidApplicationException(
                    $"Could not load the configuration for application '{applicationName}'.", ex);
            }
        }
 public ProjectItemController(TerrificNetApplication[] applications) : base(applications)
 {
 }
示例#5
0
 public HomeController(TerrificNetApplication[] applications)
 {
     _applications = applications;
 }
		public PageEditController(TerrificNetApplication[] applications)
			: base(applications)
		{ 
		}