efcore/EFCore.NamingConventions

Words attached together in property names of the object passed to `CreateTable`?

aradalvand opened this issue · 3 comments

I don't think this actually makes a functional difference but it's still weird. Is this a known issue?
This is the sort of migration that gets generated for me — notice how the words in the property names of the object passed to columns aren't separated with an underscore, they are all lowercase and not cased properly:

migrationBuilder.CreateTable(
    name: "auth_codes",
    columns: table => new
    {
        id = table.Column<int>(type: "integer", nullable: false)
            .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn),
        mobilephonenumber = table.Column<string>(name: "mobile_phone_number", type: "character varying(11)", maxLength: 11, nullable: false),
        codehash = table.Column<string>(name: "code_hash", type: "text", nullable: false),
        createdat = table.Column<Instant>(name: "created_at", type: "timestamp with time zone", nullable: false),
        clientipaddress = table.Column<IPAddress>(name: "client_ip_address", type: "inet", nullable: true),
        conclusion = table.Column<AuthCodeConclusion>(type: "auth_code_conclusion", nullable: true),
        concludedat = table.Column<Instant>(name: "concluded_at", type: "timestamp with time zone", nullable: true)
    },
    constraints: table =>
    {
        table.PrimaryKey("pk_auth_codes", x => x.id);
    });

It didn't use to be like this in the past. I'm not sure exactly when it changed but I have older migrations that don't have this problem. Is this intentional?

roji commented

Are you referring to the names of the properties on the anonymous type (id, mobilephonenumber)? I honestly have no idea - I don't think these matter in any functional way (as you wrote), but I also don't remember any intentional change here. Maybe something changed on the EF side that triggered this...

Yeah I'm referring to the properties on the anonymous type.
That's weird...
if you think this is worth investigating you can keep the issue open, otherwise feel free to close it.

roji commented

We can keep this open - I may take a look at some point (though definitely not anytime soon). Always good to know these things!