public void BuildTest()
 {
     var builder = new DBBuilder(new DBConnection
     {
         Account = "gonnatour",
         DBType = DataBaseType.MSSQL,
         Name = "gonnatour",
         Password = "******",
         Server = "localhost"
     });
     DataBase database = builder.Build();
     var parameter = new BuilderParameters { DataBase = database, OutputDirectory = new DirectoryInfo("./../DAO/"), Template = new FileInfo("./testdata/test2.tpl"),Namespace = "xCode.Test.Objects"};
     var daoBuilder = new ClassBuilder(parameter);
     var files = daoBuilder.Build();
     foreach (var file in files)
     {
         Console.WriteLine(file);
     }
     var hbmBuilder = new HBMBuilder (parameter);
     files = hbmBuilder.Build();
     foreach (var file in files)
     {
         Console.WriteLine(file);
     }
 }
Exemple #2
0
        public void Read()
        {
            var builder = new DBBuilder(new DBConnection
                                            {
                                                Account = "gonnatour",
                                                DBType = DataBaseType.MSSQL,
                                                Name = "gonnatour",
                                                Password = "******",
                                                Server = "localhost"
                                            });
            DataBase database = builder.Build();
            Console.WriteLine(database.Tables.Count);

            foreach (Table table in database.Tables)
            {
                string json = JsonUtil.Convert(table);
                Console.WriteLine("TABLE : " + json);
                foreach (Column column in table.Columns)
                {
                    json = JsonUtil.Convert(column);
                    Console.WriteLine("     COLUMN : " + json);
                    foreach (ForeignKey foreignKey in column.ForeignKeys)
                    {
                        json = JsonUtil.Convert(foreignKey);
                        Console.WriteLine("         Foreign Key : " + json);
                    }
                }
            }

            var nhBuilder =
                new HBMBuilder(new BuilderParameters
                                          {
                                              DataBase = database,
                                              Namespace = "test",
                                              OutputDirectory =
                                                  new DirectoryInfo(@"D:\Personal\VS2010\xCoder\xCoder.Test\test\nh\")
                                          });
            string[] files = nhBuilder.Build();
            foreach (string file in files)
            {
                Console.WriteLine(file);
            }
        }