protected override void ConfigureHost(IMvcTextTemplateHost host, MvcFileName fileName)
		{
			var controllerFileName = fileName as MvcControllerFileName;
			host.ControllerName = controllerFileName.ControllerName;
			host.AddActionMethods = Template.AddActionMethods;
			host.Namespace = GetNamespace();
		}
Ejemplo n.º 2
0
		public void GenerateFile(MvcFileName fileName)
		{
			using (IMvcTextTemplateHostAppDomain appDomain = CreateAppDomain()) {
				using (IMvcTextTemplateHost host = CreateHost(appDomain)) {
					GenerateFile(host, fileName);
				}
			}
		} 
 public void GenerateFile(MvcFileName fileName)
 {
     using (IMvcTextTemplateHostAppDomain appDomain = CreateAppDomain()) {
         using (IMvcTextTemplateHost host = CreateHost(appDomain)) {
             GenerateFile(host, fileName);
         }
     }
 }
Ejemplo n.º 4
0
        protected override void ConfigureHost(IMvcTextTemplateHost host, MvcFileName fileName)
        {
            var controllerFileName = fileName as MvcControllerFileName;

            host.ControllerName   = controllerFileName.ControllerName;
            host.AddActionMethods = Template.AddActionMethods;
            host.Namespace        = GetNamespace();
        }
Ejemplo n.º 5
0
		void GenerateFile(IMvcTextTemplateHost host, MvcFileName fileName)
		{
			ConfigureHost(host, fileName);
			string templateFileName = GetTextTemplateFileName();
			string outputViewFileName = fileName.GetPath();
			host.ProcessTemplate(templateFileName, outputViewFileName);
			
			Errors = host.Errors;
			if (HasErrors) {
				errorReporter.ShowErrors(Errors);
			}
		}
		protected override void ConfigureHost(IMvcTextTemplateHost host, MvcFileName fileName)
		{
			host.IsContentPage = IsContentPage;
			host.MasterPageFile = MasterPageFile;
			host.PrimaryContentPlaceHolderID = PrimaryContentPlaceHolderId;
			host.ViewDataTypeName = ModelClassName;
			host.ViewDataTypeAssemblyLocation = ModelClassAssemblyLocation;
			
			var viewFileName = fileName as MvcViewFileName;
			host.IsPartialView = viewFileName.IsPartialView;
			host.ViewName = viewFileName.ViewName;
		}
Ejemplo n.º 7
0
		void GenerateFile(IMvcTextTemplateHost host, MvcFileName fileName)
		{
			ConfigureHost(host, fileName);
			string templateFileName = GetTextTemplateFileName();
			string outputViewFileName = fileName.GetPath();
			host.ProcessTemplate(templateFileName, outputViewFileName);
			
			if (host.Errors.Count > 0) {
				CompilerError error = host.Errors[0];
				Console.WriteLine("ProcessTemplate error: " + error.ErrorText);
				Console.WriteLine("ProcessTemplate error: Line: " + error.Line);
			}
		}
        void GenerateFile(IMvcTextTemplateHost host, MvcFileName fileName)
        {
            ConfigureHost(host, fileName);
            string templateFileName   = GetTextTemplateFileName();
            string outputViewFileName = fileName.GetPath();

            host.ProcessTemplate(templateFileName, outputViewFileName);

            Errors = host.Errors;
            if (HasErrors)
            {
                errorReporter.ShowErrors(Errors);
            }
        }
Ejemplo n.º 9
0
		protected abstract void ConfigureHost(IMvcTextTemplateHost host, MvcFileName fileName);
        public static bool IsRazorFileName(string fileName)
        {
            string extension = MvcFileName.GetLowerCaseFileExtension(fileName);

            return(extension == ".cshtml");
        }
 protected abstract void ConfigureHost(IMvcTextTemplateHost host, MvcFileName fileName);
Ejemplo n.º 12
0
        public static bool IsMasterPageFileName(string fileName)
        {
            string extension = MvcFileName.GetLowerCaseFileExtension(fileName);

            return(extension == ".master");
        }