private void GenerateClass(IEntityType entityType)
        {
            if (_useDataAnnotations)
            {
                GenerateEntityTypeDataAnnotations(entityType);
            }

            var tableName = entityType.Relational().TableName;
            var comment   = CommentHelper.GetComment(tableName);

            if (!string.IsNullOrEmpty(comment))
            {
                _sb.AppendLine("/// <summary>");
                _sb.AppendLine($"/// {comment}");
                _sb.AppendLine("/// </summary>");
            }
            _sb.AppendLine($"public partial class {entityType.Name}");

            _sb.AppendLine("{");

            using (_sb.Indent())
            {
                GenerateConstructor(entityType);
                GenerateProperties(entityType);
                GenerateNavigationProperties(entityType);
            }

            _sb.AppendLine("}");
        }
        private void GenerateProperties(IEntityType entityType)
        {
            var comments = CommentHelper.GetComments(entityType.Relational().TableName);
            //occurs exception
            //var properies = entityType.GetProperties()
            //    .OrderBy(p => ScaffoldingMetadataExtensions.Scaffolding(p).ColumnOrdinal);
            var properties = entityType.GetProperties().OrderBy(p => new ScaffoldingPropertyAnnotations(p).ColumnOrdinal);

            foreach (var property in properties)
            {
                if (_useDataAnnotations)
                {
                    GeneratePropertyDataAnnotations(property);
                }
                if (comments.Count > 0)
                {
                    var columnName = property.Relational().ColumnName;
                    if (comments.ContainsKey(columnName))
                    {
                        var comment = comments[columnName];
                        _sb.AppendLine("/// <summary>");
                        _sb.AppendLine($"/// {comment}");
                        _sb.AppendLine("/// </summary>");
                        _sb.AppendLine($"[Display(Name = \"{comment}\")]");
                    }
                }

                _sb.AppendLine($"public {CSharpUtilities.GetTypeName(property.ClrType)} {property.Name} {{ get; set; }}");
            }
        }