コード例 #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
ファイル: DefaultModule.cs プロジェクト: namics/TerrificNet
        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);
            }
        }
コード例 #4
0
 public ProjectItemController(TerrificNetApplication[] applications) : base(applications)
 {
 }
コード例 #5
0
ファイル: HomeController.cs プロジェクト: namics/TerrificNet
 public HomeController(TerrificNetApplication[] applications)
 {
     _applications = applications;
 }
コード例 #6
0
		public PageEditController(TerrificNetApplication[] applications)
			: base(applications)
		{ 
		}