Пример #1
0
        public static GeneratedAssembly AssembleTypes(this ICodeFileCollection generator, GenerationRules rules)
        {
            var generatedAssembly = generator.StartAssembly(rules);

            foreach (var file in generator.BuildFiles())
            {
                file.AssembleTypes(generatedAssembly);
            }

            return(generatedAssembly);
        }
Пример #2
0
        private string generateCode(ICodeFileCollection collection)
        {
            if (collection.ChildNamespace.IsEmpty())
            {
                throw new InvalidOperationException($"Missing {nameof(ICodeFileCollection.ChildNamespace)} for {collection}");
            }

            var @namespace = collection.ToNamespace(collection.Rules);

            var generatedAssembly = new GeneratedAssembly(collection.Rules, @namespace);
            var files             = collection.BuildFiles();

            foreach (var file in files)
            {
                file.AssembleTypes(generatedAssembly);
            }

            return(generatedAssembly.GenerateCode(ServiceVariableSource));
        }