Пример #1
0
        private IEnumerable <string> AddUsing(IEnumerable <string> arg)
        {
            var(usings, rest) = TextSplitter.DivideInto2(
                arg,
                text => text == "",
                false
                );

            var implementsNamespaceUsing = $"using {OnAppendUsingNamespace(controllerName)};";
            var normalUsing = $"using UseCase.{controllerName}.{actionName};";

            var adjustedUsings = usings.ToList();

            if (adjustedUsings.All(x => !x.Contains(implementsNamespaceUsing)))
            {
                adjustedUsings.Add(implementsNamespaceUsing);
            }
            if (adjustedUsings.All(x => !x.Contains(normalUsing)))
            {
                adjustedUsings.Add(normalUsing);
            }

            adjustedUsings.Sort();

            return(adjustedUsings.Concat(rest));
        }