Exemple #1
0
        private static Collection<PgType> GetTypes(DataTable table)
        {
            Collection<PgType> types = new Collection<PgType>();

            if (table.Rows.Count.Equals(0))
            {
                return types;
            }

            foreach (DataRow row in table.Rows)
            {
                PgType type = new PgType
                {
                    RowNumber = Conversion.TryCastLong(row["row_number"]),
                    SchemaName = Conversion.TryCastString(row["schema_name"]),
                    Name = Conversion.TryCastString(row["type_name"]),
                    BaseType = Conversion.TryCastString(row["base_type"]),
                    Owner = Conversion.TryCastString(row["owner"]),
                    Collation = Conversion.TryCastString(row["collation"]),
                    Default = Conversion.TryCastString(row["default"]),
                    Type = Conversion.TryCastString(row["type"]),
                    StoreType = Conversion.TryCastString(row["store_type"]),
                    NotNull = Conversion.TryCastBoolean(row["not_null"]),
                    Definition = Conversion.TryCastString(row["definition"]),
                    Description = Conversion.TryCastString(row["description"])
                };

                types.Add(type);
            }

            return types;
        }
Exemple #2
0
        private static void BuildDocumentation(string content, PgType type)
        {
            content = content.Replace("[DBName]", Program.Database.ToUpperInvariant());

            content = Parsers.TypeParser.Parse(content, type);

            string targetPath = System.IO.Path.Combine(OutputPath, type.SchemaName, type.Name + ".html");
            FileHelper.WriteFile(content, targetPath);
        }
Exemple #3
0
        internal static string Parse(string content, PgType type)
        {
            StringBuilder items = new StringBuilder();
            items.Append(content.Replace("[Name]", type.Name)
                .Replace("[RowNumber]", type.RowNumber.ToString())
                .Replace("[TypeSchema]", type.SchemaName)
                .Replace("[BaseType]", type.BaseType)
                .Replace("[Owner]", type.Owner)
                .Replace("[Collation]", type.Collation)
                .Replace("[Default]", type.Default)
                .Replace("[Type]", type.Type)
                .Replace("[StoreType]", type.StoreType)
                .Replace("[Definition]", type.Definition)
                .Replace("[NotNull]", type.NotNull.ToString())
                .Replace("[Description]", type.Description));

            content = content.Replace(content, items.ToString());
            return content;
        }
Exemple #4
0
        internal static void Run(PgType type)
        {
            string content = FileHelper.ReadResource(TemplatePath);

            BuildDocumentation(content, type);
        }