/// <summary>
 /// コンストラクター。
 /// </summary>
 /// <param name="context"></param>
 public TableEntityTemplate(EntityTemplateContext context)
 {
     this._context = context;
 }
        private void transformEntity(string tableName, string tableType)
        {
            var context = new EntityTemplateContext(tableName, tableType)
                              {
                                  TypeNamePrefix = @"", 
                                  TypeNameSuffix = @"Entity", 
                              };
            using (var template = new TableEntityTemplate(context))
            {
                template.Initialize();
                var text = template.TransformText();
                // output
            }

            switch (tableType)
            {
                case @"BASE TABLE":
                    break;

                case @"VIEW":
                    break;

                default:
                    throw new Exception(string.Format(@"transformEntity(""{0}"", ""{1}"")", tableName, tableType));
                    break;
            }

            /*
            try
            {
                reader = new DataTableReader(schema);
                while (reader.Read())
                {
                    var name = reader.GetString(reader.GetOrdinal(@"TABLE_NAME"));
                    var text = @"";
                    switch (reader.GetString(reader.GetOrdinal(@"TABLE_TYPE")))
                    {
                        case @"BASE TABLE":
                            // DataTransferObject
                            var template = new TableEntityTemplate(name);
                            template.Initialize();
                            text = template.TransformText();

                            /*
                            // Stored Procedures
                            text = new InsertTableTemplate().TransformText();
                            text = new UpdateTableTempalte().TransformText();
                            text = new DeleteTableTemplate().TransformText();
                            text = new SelectTableTemplate().TransformText();
                            */


                            /*
                            // TableDataGateway
                            text = new TableTableDataGatewayTemplate().TransformText();

                            // Repository
                            text = new TableRepositoryTemplate().TransformText();

                            // DomainModel
                            text = new TableDomainModelsTemplate.TransformText();

                            // Xunit
                            text = new TableXunitFactsTemplate.TransformText();
                            *//*
                            break;

                        case @"VIEW":
                            /*
                            text = new ViewEntityTemplate().TransformFormat();
                            text = new CriteriaTemplate().TransformFormat();
                            text = new SelectViewTemplate().TransformText();
                            text = new ViewTableDataGatewayTemplate().TransformText();
                            text = new ViewRepositoryTemplate().TransformText();
                            text = new ViewDomainModelTemplate().TransformText();
                            text = new ViewXunitFactsTemplate().TransformText();
                            *//*
                            break;

                        default:
                            break;
                    }
                }
            }
            finally
            {
            }
            */
            }
示例#3
0
        private void transformEntity(string tableName, string tableType)
        {
            var context = new EntityTemplateContext(tableName, tableType)
            {
                TypeNamePrefix = @"",
                TypeNameSuffix = @"Entity",
            };

            using (var template = new TableEntityTemplate(context))
            {
                template.Initialize();
                var text = template.TransformText();
                // output
            }

            switch (tableType)
            {
            case @"BASE TABLE":
                break;

            case @"VIEW":
                break;

            default:
                throw new Exception(string.Format(@"transformEntity(""{0}"", ""{1}"")", tableName, tableType));
                break;
            }

            /*
             * try
             * {
             *  reader = new DataTableReader(schema);
             *  while (reader.Read())
             *  {
             *      var name = reader.GetString(reader.GetOrdinal(@"TABLE_NAME"));
             *      var text = @"";
             *      switch (reader.GetString(reader.GetOrdinal(@"TABLE_TYPE")))
             *      {
             *          case @"BASE TABLE":
             *              // DataTransferObject
             *              var template = new TableEntityTemplate(name);
             *              template.Initialize();
             *              text = template.TransformText();
             *
             *              /*
             *              // Stored Procedures
             *              text = new InsertTableTemplate().TransformText();
             *              text = new UpdateTableTempalte().TransformText();
             *              text = new DeleteTableTemplate().TransformText();
             *              text = new SelectTableTemplate().TransformText();
             */


            /*
             * // TableDataGateway
             * text = new TableTableDataGatewayTemplate().TransformText();
             *
             * // Repository
             * text = new TableRepositoryTemplate().TransformText();
             *
             * // DomainModel
             * text = new TableDomainModelsTemplate.TransformText();
             *
             * // Xunit
             * text = new TableXunitFactsTemplate.TransformText();
             *//*
             * break;
             *
             * case @"VIEW":
             * /*
             * text = new ViewEntityTemplate().TransformFormat();
             * text = new CriteriaTemplate().TransformFormat();
             * text = new SelectViewTemplate().TransformText();
             * text = new ViewTableDataGatewayTemplate().TransformText();
             * text = new ViewRepositoryTemplate().TransformText();
             * text = new ViewDomainModelTemplate().TransformText();
             * text = new ViewXunitFactsTemplate().TransformText();
             *//*
             * break;
             *
             * default:
             * break;
             * }
             * }
             * }
             * finally
             * {
             * }
             */
        }