question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] Add possibility to mention full namespace for entities location

See original GitHub issue

Hi!

I have the following scenario: Generating the table structure (Entities) in one project, and generating the DbContext and configuration files in another project. The result of this approach is that the context and configuration files need a reference to the namespace where the entity files are located. I tried using the EntityTypes sub-namespace feature, but this just appends the input namespace to the destination project’s own namespace - which I assume is what it is meant to do.

The only solution I currently have is to manually edit the DbContext and configuration files to add the reference to where the entities are located.

It would be nice to be allowed to specify exactly where the entities are or will be located so that their full namespace can be added to the generated context and configuration files, without the need to manually edit them.

I know you already heard this a lot, but this extension is such an time-saver, thank you very much for doing this!

If you need extra print screens or other details, I’ll happily provide them.

Further technical details

EF Core Power Tools version: 2.4.217.0

Database engine: SQL Server 2016

Visual Studio version: Visual Studio 2019 v. 16.4.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Marmotorcommented, Sep 27, 2020

That is where I came up with the idea to use the handlebars. The second time I looked after you mentioned handlebars are not required, I noticed a link to this same issue someone else mentioned and that’s where I found the following solution: Top namespace input should be the common namespace part for the two projects. Then specify in the EntityTypes sub-namespace input the rest of the namespace to where your entities are located and in the DbContext sub-namespace input the rest for the DbContext location. This results in the concatenation of the common namespace part and the Entity namespace in a using statement which will be injected in the generated context and configuration files.

0reactions
ErikEJcommented, Sep 27, 2020

Would be great if you could provide more details with a sample perhaps?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing Namespaces in Entity Framework
There is only a property file called Web File Properties that simply has 3 properties: Custom Tool; File Name; Full Path. What am...
Read more >
Names of Namespaces - Framework Design Guidelines
Use these guidelines for naming namespaces as part of guidelines for designing libraries that extend and interact with .NET libraries.
Read more >
Namespaces - C# language specification
This chapter defines namespaces, including how to declare them and how to use them.
Read more >
Configuring Namespaces | System Administration Guide
Mapping Data to All Namespaces · First, create a namespace named %ALL, as described in Create/Modify a Namespace. Note: · Then, make the...
Read more >
Secure multi-tenancy with namespaces | Vault
The namespaces feature is designed to create an isolation around each namespace so that Vault tenants can operate independently by having a mini-Vault ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found