Ejemplo n.º 1
0
        public static IEnumerable <TypeScriptDeclarationOrStatement> GetImportStatementsForEntity(Spec spec, string entityName)
        {
            var targetInfo         = spec.Targets[Constants.TypeScriptTarget];
            var enumDependencies   = spec.GetDirectEnumDependencies(Constants.TypeScriptTarget, entityName);
            var entityDependencies = spec.GetDirectEntityDependencies(Constants.TypeScriptTarget, entityName);

            foreach (var @enum in enumDependencies)
            {
                yield return(new TypeScriptImportStatement {
                    ObjectName = SpecFunctions.ToPascalCase(@enum), File = TypeScriptFileUtilities.GetFileName(@enum, targetInfo.AppendGeneratedExtension)
                });
            }

            foreach (var entity in entityDependencies)
            {
                yield return(new TypeScriptImportStatement {
                    ObjectName = SpecFunctions.ToPascalCase(entity), File = TypeScriptFileUtilities.GetFileName(entity, targetInfo.AppendGeneratedExtension)
                });
            }
        }