Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose internal classes #40

Open
rfpedrosa opened this issue Oct 8, 2020 · 2 comments
Open

Expose internal classes #40

rfpedrosa opened this issue Oct 8, 2020 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@rfpedrosa
Copy link

Sometimes, I end up defining how things should be named in the DB. For example:

.UseHiLo($"{nameof(MyClass).ToSnakeCase()}_hilo")

builder.OwnsMany(o => o.Contours, io =>
            {
                io.WithOwner();
                io.ToTable(nameof(ImagePoint).ToSnakeCase());
            });

I end up writing my own string extension to have consistent snake case naming but, ideally, I would reuse SnakeCaseNameRewriter:

  1. for a higher degree of consistency;
  2. do the same thing with less code (no need to define my own ToSnakeCase if the library I'm using also has that...
@roji roji added this to the Backlog milestone Jan 3, 2024
@jmzagorski
Copy link

I also have a use case for this that relates to table sharing. I've found that I need to call HasColumnName for two entities to share a table's column. It would be nice if there was a public method for this plugin that would convert our name to the convention we choose on DbContextOptionsBuilder<TContext> when we have to use HasColumnName. For example .HasColumnName(RewriteName(nameof(Entity.PropertyName))

@roji roji modified the milestones: Backlog, 9.0.0 May 25, 2024
@roji roji added the enhancement New feature or request label May 25, 2024
@erikbozic
Copy link

erikbozic commented Oct 8, 2024

Isn't this possible with: var snakeCasedColumnName = new SnakeCaseNameRewriter(CultureInfo.InvariantCulture).RewriteName(nameof(MyEntity.MyColumn));

Or is this somehow not desirable to use, since it's in an "Internal" namespace? (EFCore.NamingConventions.Internal)

(It was exposed way back in: d4bacdc)

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

No branches or pull requests

4 participants