Skip to content

Conversation

@JohnGoldInc
Copy link
Contributor

@JohnGoldInc JohnGoldInc commented Apr 28, 2020

This provides for the ability to folder Entities by the schema of the tables,
And keeps class naming to the same standard of capability.

Closes #111

@tonysneed tonysneed added the enhancement New feature or request label Apr 28, 2020
@tonysneed
Copy link
Contributor

@JohnGoldInc As I described in #99, I don't think schema foldering has anything to do with transformers, and you should not have to use them in order to add the schema folders.

Instead, I think a preferable approach would be to add an EnableSchemaFolders property to ReverseEngineerOptions so that you can set it to true in ConfigureDesignTimeServices when calling services.AddHandlebarsScaffolding.

What do you think?

@JohnGoldInc
Copy link
Contributor Author

JohnGoldInc commented Apr 28, 2020 via email

@tonysneed
Copy link
Contributor

It won't be difficult to add transformers support via arguments for services.AddHandlebarsTransformers. That can be a separate PR.

It would be great if you could create a new PR from scratch that takes the approach I suggested. To do this create a new branch from the latest commit on my master branch (5b2d3d2). Use this branch for your new PR.

For some guidance on creating the PR, please refer to the Contributing Guidelines.

@JohnGoldInc
Copy link
Contributor Author

@tonysneed Ok was looking at ReverseEngineerOptions it would have to change to be a binary pipe concatenated.

So the original code:

    public enum ReverseEngineerOptions
    {
        /// <summary>
        /// Generate DbContext class only.
        /// </summary>
        DbContextOnly,

        /// <summary>
        /// Generate entity type classes only.
        /// </summary>
        EntitiesOnly,

        /// <summary>
        /// Generate both DbContext and entity type classes.
        /// </summary>
        DbContextAndEntities
    }

would become :

    public enum ReverseEngineerOptions
    {
        /// <summary>
        /// Generate DbContext class only.
        /// </summary>
        DbContextOnly = 1,

        /// <summary>
        /// Generate entity type classes only.
        /// </summary>
        EntitiesOnly = 2,

        /// <summary>
        /// Generate both DbContext and entity type classes.
        /// can also use syntax 'ReverseEngineerOptions.DbContextOnly | ReverseEngineerOptions.EntitiesOnly '
        /// </summary>
        DbContextAndEntities = 1 + 2,

        /// <summary>
        /// Generate schema folders for entity type classes
        /// i.e. 'ReverseEngineerOptions.DbContextAndEntities | ReverseEngineerOptions.EnableSchemaFolders '
        /// </summary>
        EnableSchemaFolders = 4,
    }

And code changed to test via binary matching instead of equivalency throughout project.

Sound Good?

@JohnGoldInc
Copy link
Contributor Author

JohnGoldInc commented Apr 29, 2020

@tonysneed And regarding #99 "EnableNullableReferenceTypes = 8" because the numbering needs to be an exponent of 2

@tonysneed
Copy link
Contributor

tonysneed commented Apr 29, 2020

@JohnGoldInc Sorry, I meant HandlebarsScaffoldingOptions, not ReverseEngineerOptions.

public class HandlebarsScaffoldingOptions
{
    public bool EnableSchemaFolders { get; set; }
    public bool EnableNullableReferenceTypes { get; set; } // Not part of this issue/PR

Please discuss EnableNullableReferenceTypes in #101.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Schema Foldering support

2 participants