Exemple #1
0
        /// <summary>
        /// Program entry point.
        /// </summary>
        /// <param name="args">Program arguments.</param>
        private static void Main(string[] args)
        {
            IUnityContainer container = new UnityContainer().LoadConfiguration();
            string schemaFile;
            IEnumerable<IArtifactGenerator> generators;

            if (args.Length > 0)
            {
                schemaFile = args[0];
                SourceCodeGenerator generator = container.Resolve<IArtifactGenerator>("SourceCodeGenerator") as SourceCodeGenerator;
                Parser.Default.ParseArguments(args, generator.Configuration);
                generators = new List<IArtifactGenerator>() { generator };
            }
            else
            {
                schemaFile = ConfigurationManager.AppSettings.Get("SchemaFile");
                generators = container.ResolveAll<IArtifactGenerator>();
            }

            NoSqlSchema schema = null;
            using (StreamReader reader = new StreamReader(schemaFile))
            {
                string fileContent = reader.ReadToEnd();
                schema = JsonConvert.DeserializeObject<NoSqlSchema>(fileContent);
            }

            Program program = new Program(schema, generators);
            program.Run();
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Program"/> class.
 /// </summary>
 /// <param name="schema">The No-SQL database schema.</param>
 /// <param name="generators">The list of artifact generators.</param>
 public Program(NoSqlSchema schema, IEnumerable<IArtifactGenerator> generators)
 {
     this.schema = schema;
     this.generators = generators.ToList();
 }