예제 #1
0
		public MessageFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			Template = new MessageTemplate {File = this};
			Name = string.Format("{0}Message", Name);
			HasDetail = type.HasDetailFlag;
		}
예제 #2
0
		public ServiceFile(ProjectFacade project, TypeFacade type, Resource resource) 
			: base(project, type, resource)
		{
			Template = new ServiceTemplate { File = this };
			Name = resource.Name;			
			Name = $"{Name}Service";
		}
예제 #3
0
		public DetailQueryFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			Template = new DetailQueryTemplate {File = this};
			Name = string.Format("{0}DetailQuery", Name);
			if (HasContext)
				PageSpecificUsingStatements.Add(ContextNamespace);
		}
예제 #4
0
		protected TypedTestFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			Tests = Vs.Helper.TestingFramework;
			Tests.RequiredNamespaces.AsEnumerable()
				.ForEach(c => PageSpecificUsingStatements.Add(c));
			PageSpecificUsingStatements.Add("FluentAssertions");
		}
예제 #5
0
		public AddCommandTestsFile(ProjectFacade project, TypeFacade type, ProjectFacade logic)
			: base(project, type)
		{
			Template = new AddCommandTestsTemplate {File = this};
			Name = string.Format("{0}AddCommandTests", Name);
			PageSpecificUsingStatements.Add(logic.RootNamespace + ".Operations." + PluralName);
			PageSpecificUsingStatements.Add("Voodoo.TestData");
		}
예제 #6
0
		public MappingTestsFile(ProjectFacade project, TypeFacade type, ProjectFacade logic)
			: base(project, type)
		{
			Template = new MappingTestsTemplate {File = this};
			Name = string.Format("{0}MappingTests", Name);
			PageSpecificUsingStatements.Add(logic.RootNamespace + ".Operations." + PluralName);
			PageSpecificUsingStatements.Add(Type.Namespace);
		}
예제 #7
0
		public SampleFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			Template = new SampleTemplate {File = this};
			Name = string.Format("{0}Sample", Name);
			PageSpecificUsingStatements.Add(ContextNamespace);
			PageSpecificUsingStatements.Add(type.Namespace);
			PageSpecificUsingStatements.Add("Voodoo.Infrastructure");
		}
예제 #8
0
		public HelperFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			FriendlyName = Name.ToFriendlyString();
			Template = new HelperTemplate {File = this};
			Name = string.Format("{0}Helper", Name);
			PageSpecificUsingStatements.Add(Type.Namespace);
			Errors = type.Properties.SelectMany(c => c.ErrorMessages).Select(c => c.Text).ToArray();
		}
예제 #9
0
			public Mapping(TypeFacade entity, List<GeneratedProperty> messageProperties, string name = null)
			{
				ModelTypeName = entity.Name;
				Properties = messageProperties.Select(c => c.Property).ToArray();
				PropertiesWithoutId = messageProperties.Select(c => c.Property).Where(c => c.Name != "Id").ToArray();
				MessageTypeName = name == "Detail" ? $"{entity.Name}MessageDetail" : $"{entity.Name}Message";
				buildNames(name);

			}
예제 #10
0
		public TestHelperFile(ProjectFacade project, TypeFacade type, ProjectFacade logic)
			: base(project, type)
		{			
			Template = new TestHelperTemplate {File = this};
			Name = string.Format("{0}TestHelper", Name);
			PageSpecificUsingStatements.Add(logic.RootNamespace + ".Operations." + PluralName);
			PageSpecificUsingStatements.Add("Voodoo.TestData");
			PageSpecificUsingStatements.Add(ContextNamespace);
			PageSpecificUsingStatements.Add(logic.RootNamespace);			
		}
예제 #11
0
		public EditCommandFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			Template = new EditCommandTemplate {File = this};
			Name = string.Format("{0}EditCommand", Name);
			PageSpecificUsingStatements.Add(ContextNamespace);
			PageSpecificUsingStatements.Add(type.Namespace);
			PageSpecificUsingStatements.Add("Voodoo.Infrastructure");
			UseSoftEdit = type.HasActiveFlag;
		}
예제 #12
0
		public TypeComparer(TypeFacade left, TypeFacade right)
		{
			LeftType = left;
			RightType = right;
			var commonProperties = left.Properties.Where(c => right.Properties.Any(p => p.Name == c.Name)).ToArray();
			ScalarProperties = commonProperties.Where(c => c.PropertyType.IsScalar()).ToArray();
			ScalarPropertiesWithoutId = ScalarProperties.Where(c => c.Name != "Id").ToArray();
			CollectionProperties =
				commonProperties.Where(c => c.PropertyType.IsEnumerable()).Except(ScalarProperties).ToArray();
			ComplexProperties = commonProperties.Except(ScalarProperties).Except(CollectionProperties).ToArray();
		}
예제 #13
0
		public ListQueryFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			Template = new ListQueryTemplate {File = this};
			Name = string.Format("{0}ListQuery", Name);
			if (HasContext)
			{
				PageSpecificUsingStatements.Add(ContextNamespace);
				PageSpecificUsingStatements.Add("Voodoo");
			}
		}
예제 #14
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();
		}
예제 #15
0
			public Mapping(TypeFacade entity, TypeFacade message, string name = null)
			{
				ModelTypeName = entity.Name;
				MessageTypeName = message.Name;

				name = name ?? message.Name;
				var properties = new TypeComparer(entity, message);
				Properties = properties.ScalarProperties;
				PropertiesWithoutId = properties.ScalarPropertiesWithoutId;
				buildNames(name);

			}
예제 #16
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};
		}
예제 #17
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();
		}
예제 #18
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);
			}
		}
예제 #19
0
		public TestFile(ProjectFacade project, TypeFacade type, ProjectFacade logic)
			: base(project, type)
		{
			this.Operation = Operation.DiscoverTypes(type.SystemType, new Operation());
			if (Operation != null)
			{ 
			
			this.PageSpecificUsingStatements.Add(Operation.RequestType.Namespace);
			}
			LogicProject = logic;
			Template = new TestTemplate { File = this };
			Name = string.Format("{0}Tests", Name);
			PageSpecificUsingStatements.Add(ContextNamespace);
			PageSpecificUsingStatements.Add(logic.RootNamespace);
			PageSpecificUsingStatements.Add(Type.Namespace);
		}
예제 #20
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();


		}
예제 #21
0
		public MapperFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			HasDetail = type.HasDetailFlag;
			Template = new MapperTemplate { File = this };
			Name = string.Format("{0}Mapper", Name);
			ModelName = string.Format("{0}", type.Name);
			PageSpecificUsingStatements.Add(Type.Namespace);

			OverwriteExistingFile = true;
			var modelType = type;

			var messageType = Vs.Helper.FindType(Type.MessageName);

			addMapping(messageType, Type.MessageProperties, $"Message");

			if (HasDetail)
			{
				messageType = Vs.Helper.FindType(Type.DetailName);
				addMapping(messageType, Type.DetailMessageProperties, $"Detail");
			}

			var mappings = project.MappingTypes.ToArray();

			foreach (var map in mappings)
			{
				var attribute = map.GetCustomAttribute<MapsToAttribute>();
				if (attribute.Type.FullName == type.SystemType.FullName)
				{					
						var facade = new TypeFacade(map);
						Mappings.Add(new Mapping(Type, facade));
						PageSpecificUsingStatements.Add(facade.SystemType.Namespace);

				}
			}
		}
예제 #22
0
		public MappingFile(TypeFacade left, TypeFacade right)
		{
			Template = new MappingTemplate {File = this};
			Types = new TypeComparer(left, right);
		}
예제 #23
0
		public ListsQueryFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			Template = new ListsQueryTemplate {File = this};
			Name = string.Format("{0}ListsQuery", Name);
		}
예제 #24
0
		public QueryResponseFile(ProjectFacade project, TypeFacade type)
			: base(project, type)
		{
			Template = new QueryResponseTemplate {File = this};
			Name = string.Format("{0}QueryResponse", Name);
		}
예제 #25
0
		public static TypeFacade CreateEmptyType(string targetTypeName)
		{
			var typeFacade = new TypeFacade(typeof(System.Empty));	
			typeFacade.createNames(targetTypeName);
			typeFacade.Namespace = "System";
			typeFacade.IsFake = true;
			return typeFacade;
		}
예제 #26
0
		protected TypedCodeFile(ProjectFacade project, TypeFacade type) : base(project)
		{
			Type = type;
			var pluralizer = new EnglishPluralizationService();
			if (type != null)
			{
				Name = type.Name;
				PluralName = pluralizer.Pluralize(Name);
			}
		}
예제 #27
0
		protected TypedUiScratchFile(TypeFacade project)
		{
		}
예제 #28
0
		private void addMapping(TypeFacade messageType, List<GeneratedProperty> properties, string name)
		{

			if (messageType == null)
			{
				Mappings.Add(new Mapping(Type, properties, name));
			}
			else
			{
				Mappings.Add(new Mapping(Type, messageType, name));
			}
		}
예제 #29
0
		public TsServiceFile(ProjectFacade project, TypeFacade type, Resource resource) 
			: base(project, type, resource)
		{
			Template = new TsServiceTemplate { File = this };
		}
예제 #30
0
		public TypeScriptModel(TypeFacade target)
		{
			targetType = target;
		}