public void Generate(DatabaseDefinition databaseDefinition)
        {
            Log(LogSeverity.Information, "Starting on {DatabaseName}.", "BimGenerator", DatabaseName);

            var root = new BimGeneratorRoot
            {
                Model = new BimGeneratorModel()
            };

            BimHelper.SetDefaultAnnotations(root.Model);
            BimHelper.SetDefaultDataSources(root.Model, DatabaseName);

            var relationShipRegistrations = new RelationShipRegistrations();

            foreach (var sqlTable in databaseDefinition.GetTables())
            {
                if (!Context.Customizer.ShouldSkip(sqlTable.SchemaAndTableName) &&
                    !DocumenterWriterBase.ShouldSkipKnownTechnicalTable(sqlTable.SchemaAndTableName)
                    )
                {
                    root.Model.Tables.Add(GenerateTable(sqlTable));
                    Context.Logger.Log(LogSeverity.Debug, "Table {TableName} added to bim model.", "BimGenerator", sqlTable.SchemaAndTableName);
                    GatherReferencedTablesByFK(relationShipRegistrations, sqlTable);
                }
            }

            GenerateReferences(relationShipRegistrations, root.Model);

            var jsonString = ToJson(root);

            jsonString = RemoveInvalidEmptyItems(jsonString);
            WriteJson(jsonString);
        }
        private Table GenerateTable(SqlTable sqlTable, string overrideName = null)
        {
            var table = new Table
            {
                Name = GetBimTableName(sqlTable.SchemaAndTableName)
            };

            if (overrideName != null)
            {
                table.Name = overrideName;
            }

            foreach (var sqlColumn in sqlTable.Columns)
            {
                var column = new Column
                {
                    // TODO mapping
                    Name         = sqlColumn.Name,
                    DataType     = sqlColumn.Types[Version].SqlTypeInfo.SqlDataType,
                    SourceColumn = sqlColumn.Name
                };

                table.Columns.Add(column);
            }

            BimHelper.SetDefaultPartition(table, sqlTable, DatabaseName);

            return(table);
        }