Skip to content

Feature Suggestion for Model Namespace #1524

Closed

Description

@FeraMJ

Describe what is not working as expected.

Provide steps to reproduce

Please include a complete description or project that I can redo/run to reproduce the issue.

Provide technical details

  • EF Core version in use: (e.g. EF Core 6)

  • Is Handlebars used: no/yes

  • Is .dacpac used: no/yes

  • EF Core Power Tools version: (found in About dialog - blue questionmark icon on context menu)

  • Database engine: (SQL Server, Azure SQL, Postgres, Oracle, Firebird, SQLite, MySQL)

  • Visual Studio version: (e.g. Visual Studio 2022)

Activity

  1. FeraMJ commented on Sep 22, 2022

    @FeraMJ
    Author

    Hello. I have a specific use case where the models of a specific API controller are used throughout the app, and it is therefore useful to have them in the root namespace (rather than add "using" lines to every class). The EF Core PowerTools allows for custom namespaces for models. That is great. The limitation is that it only allows "sub-namespaces".

    If there were a "use root" option, that would be great. In the example below, I enter "DELETE" and then search/replace it out each time I rerun Reverse Engineering.

    image

  2. ErikEJ commented on Sep 22, 2022

    @ErikEJ
    Owner

    So you want the namespace for the entities to be "Codify" and the DbContext namespace should be "Codify.Areas.Core.Data" ??

  3. ErikEJ commented on Sep 22, 2022

    @ErikEJ
    Owner

    I think you can leave the "Namespace" text box empty, and define an explict namespace for Entity and DbContext in the sub-namespace text boxes

  4. FeraMJ commented on Sep 22, 2022

    @FeraMJ
    Author

    You are correct. That did the job. Thanks again!

    image

  5. ErikEJ commented on Sep 22, 2022

    @ErikEJ
    Owner

    I have added this example to the docs

  6. added
    question
    on Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions