예제 #1
0
 public GeneratedAssembly(GenerationRules generation)
 {
     Generation = generation;
 }
예제 #2
0
 public GeneratedType(GenerationRules rules, string typeName)
 {
     Rules    = rules;
     TypeName = typeName;
 }
예제 #3
0
 public GeneratedAssembly(GenerationRules rules)
 {
     Rules     = rules;
     Namespace = rules.ApplicationNamespace;
 }
예제 #4
0
 public GeneratedAssembly(GenerationRules rules, string ns)
 {
     Namespace = ns;
     Rules     = rules;
 }
예제 #5
0
 public GeneratedType(GenerationRules rules, string typeName)
 {
     Rules     = rules;
     TypeName  = typeName;
     Namespace = rules.ApplicationNamespace;
 }
예제 #6
0
        public static GeneratedAssembly StartAssembly(this ICodeFileCollection generator, GenerationRules rules)
        {
            if (generator.ChildNamespace.IsEmpty())
            {
                throw new InvalidOperationException($"Missing {nameof(ICodeFileCollection.ChildNamespace)} for {generator}");
            }

            var @namespace = $"{rules.ApplicationNamespace}.{generator.ChildNamespace}";

            return(new GeneratedAssembly(rules, @namespace));
        }
예제 #7
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);
        }
예제 #8
0
 public static string ToNamespace(this ICodeFileCollection codeFileCollection, GenerationRules rules)
 {
     return($"{rules.ApplicationNamespace}.{codeFileCollection.ChildNamespace}");
 }
예제 #9
0
 public DynamicCodeBuilder(GenerationRules rules, IServiceProvider services, IGeneratesCode[] generators)
 {
     _rules      = rules;
     _services   = services;
     _generators = generators;
 }