Ejemplo n.º 1
0
		public ServiceFile(ProjectFacade project, TypeFacade type, Resource resource) 
			: base(project, type, resource)
		{
			Template = new ServiceTemplate { File = this };
			Name = resource.Name;			
			Name = $"{Name}Service";
		}
Ejemplo n.º 2
0
		protected TsServiceFileBase(ProjectFacade project, TypeFacade type, Resource resource)
			: base(project, type)
		{
			Name = resource.Name;
			TsName = firstLetterLower(Name);
			Name = $"{Name}Factory";
			Resource = resource;
			OverwriteExistingFile = true;
			
			Builder = new TypeScriptGraphBuilder();
		}
Ejemplo n.º 3
0
		public JsServiceFile(ProjectFacade project, TypeFacade type, Resource resource)
			: base(project, type)
		{
			Name = resource.Name;
			Template = new JsServiceTemplate {File = this};
			JsName = firstLetterLower(Name);
			Name = string.Format("{0}Factory", Name);
			Resource = resource;
			OverwriteExistingFile = true;

			Template = new JsServiceTemplate {File = this};
		}
Ejemplo n.º 4
0
		public static CodeFile GetJavaScriptFile(ProjectFacade web, TypeFacade type, Resource item)
		{
			if (Vs.Helper.Solution.WebFramework == WebFramework.Angular1)
			{
				var service = new Angular.JsServiceFile(web, type, item);
				return service;
			}
			else if (Vs.Helper.Solution.WebFramework == WebFramework.Aurelia)
			{
				var service = new Aurelia.JsServiceFile(web, type, item);
				return service;
			}
			throw new NotImplementedException();
		}
Ejemplo n.º 5
0
		public ApiControllerFile(ProjectFacade project, TypeFacade type, Resource resource)
			: base(project, type)
		{
			Resource = resource;
			OverwriteExistingFile = true;
			Template = new ApiControllerTemplate {File = this};
			Name = resource.Name;
			PageSpecificUsingStatements.Add("Voodoo.Messages");
			foreach (var verb in resource.Verbs)
			{
				addNamespaces(verb.OperationType);
				addNamespaces(verb.RequestType);
				addNamespaces(verb.ResponseType);
			}
		}
Ejemplo n.º 6
0
		public static TsServiceFileBase GetTypeScriptFile(ProjectFacade web, TypeFacade type, Resource item)
		{
			//TODO:refactor
			if (Vs.Helper.Solution.WebFramework == WebFramework.Angular1)
			{
				var service = new Angular.TsServiceFile(web, type, item);
				service.Template = new Angular.TsServiceTemplate { File = service };
				return service;
			}
			else if (Vs.Helper.Solution.WebFramework == WebFramework.Aurelia)
			{
				var service = new Aurelia.TsServiceFile(web, type, item);
				service.Template = new Aurelia.TsServiceTemplate { File = service };
				return service;
			}
			throw new NotImplementedException();


		}
Ejemplo n.º 7
0
		public RestBuilder(ProjectFacade logic)
		{
			Resources = new List<Resource>();
			var assembly = logic.Assembly;
			Type[] types = assembly.GetTypesSafetly();
			var interestingTypes =
				types.Where(c => c.GetCustomAttributes(typeof (RestAttribute), false).Any()).ToArray();

			var resources =
				interestingTypes.ToLookup(
					c => c.GetCustomAttributes(typeof (RestAttribute), false).First().To<RestAttribute>().Resource,
					c => buildVerb(c.GetCustomAttributes(typeof (RestAttribute), false).First(), c));
			foreach (var key in resources.Select(c => c.Key).ToArray())
			{
				var name = key;
				var resource = new Resource
				{
					Name = name,
					ClassName = $"{name}Controller"
				};
				resource.Verbs.AddRange(resources[key]);
				Resources.Add(resource);
			}
		}
Ejemplo n.º 8
0
		public TsServiceFile(ProjectFacade project, TypeFacade type, Resource resource) 
			: base(project, type, resource)
		{
			Template = new TsServiceTemplate { File = this };
		}