public MessageFile(ProjectFacade project, TypeFacade type) : base(project, type) { Template = new MessageTemplate {File = this}; Name = string.Format("{0}Message", Name); HasDetail = type.HasDetailFlag; }
public ServiceFile(ProjectFacade project, TypeFacade type, Resource resource) : base(project, type, resource) { Template = new ServiceTemplate { File = this }; Name = resource.Name; Name = $"{Name}Service"; }
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); }
protected TypedTestFile(ProjectFacade project, TypeFacade type) : base(project, type) { Tests = Vs.Helper.TestingFramework; Tests.RequiredNamespaces.AsEnumerable() .ForEach(c => PageSpecificUsingStatements.Add(c)); PageSpecificUsingStatements.Add("FluentAssertions"); }
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"); }
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); }
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"); }
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(); }
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); }
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); }
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; }
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(); }
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"); } }
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(); }
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); }
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}; }
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(); }
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); } }
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); }
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(); }
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); } } }
public MappingFile(TypeFacade left, TypeFacade right) { Template = new MappingTemplate {File = this}; Types = new TypeComparer(left, right); }
public ListsQueryFile(ProjectFacade project, TypeFacade type) : base(project, type) { Template = new ListsQueryTemplate {File = this}; Name = string.Format("{0}ListsQuery", Name); }
public QueryResponseFile(ProjectFacade project, TypeFacade type) : base(project, type) { Template = new QueryResponseTemplate {File = this}; Name = string.Format("{0}QueryResponse", Name); }
public static TypeFacade CreateEmptyType(string targetTypeName) { var typeFacade = new TypeFacade(typeof(System.Empty)); typeFacade.createNames(targetTypeName); typeFacade.Namespace = "System"; typeFacade.IsFake = true; return typeFacade; }
protected TypedCodeFile(ProjectFacade project, TypeFacade type) : base(project) { Type = type; var pluralizer = new EnglishPluralizationService(); if (type != null) { Name = type.Name; PluralName = pluralizer.Pluralize(Name); } }
protected TypedUiScratchFile(TypeFacade project) { }
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)); } }
public TsServiceFile(ProjectFacade project, TypeFacade type, Resource resource) : base(project, type, resource) { Template = new TsServiceTemplate { File = this }; }
public TypeScriptModel(TypeFacade target) { targetType = target; }