ErikEJ / erikej.github.io

ErikEJ blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EF Core Power Tools database reverse engineering: renaming of entities and properties

ErikEJ opened this issue · comments

When using 2.4.217.0, EF Core 5.0 Preview, Advanced, Generate stored procedure Mappings (preview) on a database, it works great. When I pointed to another database, there was a DbContextExtensions.cs file in the new folder that was conflicting with the first one, for a different database, in a different folder. If I move the static class of each of the DbContextExtensions.cs files to a namespace, based on the folder path, it works fine. I didn't know if there was something I needed to do when I used the tool or if this was a bug, or by design.

I usually do not recommend having multiple DbContexts in the same project. But please file an issue, it should be possible to do better.

The tool creates one each time I point to a different database. I have a website that pulls from 5 different systems. I believe by adding a Namespace around the class will fix the issue. Or, allow to rename. If you think that would work, I can put in an issue.

Yes, using the namespace will probably solve it.

@KayakFisher205 Fixed in latest daily build

This does not seem to work for collection-level properties.

I tried to rename my property

    public virtual ICollection<Attachment> Attachment { get; set; }

to be renamed to

    public virtual ICollection<Attachment> Attachments { get; set; }

but that doesn't happen ... should it? Or if not: could that be a new feature to add to the renaming functionality soonish?