static void Test()
        {
            var connectionStr = "Data Source=localhost;Initial Catalog=PAHSCO;Integrated Security=True";
            var provider      = new DbMetaProvider(connectionStr);
            var generator     = new CodeGenerator(provider);


            /*Solution 的位置*/
            //generator.BasePath = @"D:\Jax-Work\Dropbox\JW-Project\PAHSCO.WMS\PAHSCO.MCS.MVC";
            generator.BasePath        = @"D:\temp";
            generator.DataContextName = "MCSDataContext";
            generator.NameSpace       = "PAHSCO.WMS";
            generator.IsOverride      = true;

            var tables = new[] {
                "JDE_OrderCommandReply",
                "JDE_SrcOrderCommand",
            };

            var tpls = new [] {
                "Mvc.ViewModelTemplate",
                "Wcf.DomainTemplate",
            };

            generator.Execute(tpls, tables, (isGenerate, filePath) => {
                if (!isGenerate)
                {
                    Console.WriteLine("已存在 " + filePath);
                }
            });


            Console.WriteLine("Complete !");
        }
Example #2
0
        public CodeGenerateForm()
        {
            _dbMetaProvider = new DbMetaProvider();
            _codeGenerator  = new CodeGenerator(_dbMetaProvider);


            /*初始化组件*/
            InitializeComponent();


            /*建立樣版選項*/
            var tplCheckBoxs = _codeGenerator.TemplateTypes.Select((x, i) => new CheckBox
            {
                Name     = x.FullName,
                Text     = x.FormatTemplateName(),
                Size     = new System.Drawing.Size(110, 16),
                TabIndex = 21 + i,
                TabStop  = true,
            });

            _templateSelect.Controls.AddRange(tplCheckBoxs.ToArray());



            /*初始化設定*/
            this._cntStringBox.Items.AddRange(_settings.CntStringItems.Cast <string>().ToArray());
            this._solutionBox.Items.AddRange(_settings.SolutionItems.Cast <string>().ToArray());
            this.Size = _settings.FormSize;
        }
 public CodeGenerator(DbMetaProvider dbMetaProvider)
 {
     _dbMetaProvider = dbMetaProvider;
 }